]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: fix cosmetic issue with exit race
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 23 Aug 2017 14:23:17 +0000 (16:23 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 23 Aug 2017 22:18:53 +0000 (00:18 +0200)
if we're using --terminal, the daemon may in some cases exit fast enough
for the parent to see this; this resulted in a confusing/bogus "failed
to start, exited 0" message.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/libfrr.c

index c3ef04c673a50760f524d00fb9275ad509fc343f..9944fdd1e163ad6ab8bad34a3f43efb95ede36dd 100644 (file)
@@ -641,7 +641,10 @@ static void frr_daemon_wait(int fd)
                exit(0);
 
        /* child failed one way or another ... */
-       if (WIFEXITED(exitstat))
+       if (WIFEXITED(exitstat) && WEXITSTATUS(exitstat) == 0)
+               /* can happen in --terminal case if exit is fast enough */
+               (void)0;
+       else if (WIFEXITED(exitstat))
                fprintf(stderr, "%s failed to start, exited %d\n", di->name,
                        WEXITSTATUS(exitstat));
        else if (WIFSIGNALED(exitstat))