slcand: move setting of loop variable back into code context

With commit 33a9249571 ("slcand: daemonise only once setup is complete")
the daemonize syscall is moved behind serial tty setup.

This patch moves the missing assignment of the loop variable slcand_running
to get it into the code context of the while() loop.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
pull/88/head
Oliver Hartkopp 2018-04-29 19:02:55 +02:00
parent 872b73766c
commit 47f2e7a180
1 changed files with 2 additions and 3 deletions

View File

@ -280,9 +280,6 @@ int main(int argc, char *argv[])
syslogger(LOG_INFO, "starting on TTY device %s", ttypath);
/* */
slcand_running = 1;
fd = open(ttypath, O_RDWR | O_NONBLOCK | O_NOCTTY);
if (fd < 0) {
syslogger(LOG_NOTICE, "failed to open TTY device %s\n", ttypath);
@ -399,6 +396,8 @@ int main(int argc, char *argv[])
signal(SIGTERM, child_handler);
}
slcand_running = 1;
/* The Big Loop */
while (slcand_running)
sleep(1); /* wait 1 second */