fix control flow if kill() command fails to end program
authorHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Mon, 22 Oct 2012 12:29:30 +0000 (14:29 +0200)
committerHenning Rogge <henning.rogge@fkie.fraunhofer.de>
Mon, 22 Oct 2012 12:29:30 +0000 (14:29 +0200)
    Coverity:
    CID 739665 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
    At (17): "ifp->olsr_socket" is passed to a parameter that cannot be negative.

Signed-off-by: Henning Rogge <henning.rogge@fkie.fraunhofer.de>
src/unix/ifnet.c

index cbb1c60..7cf8d62 100644 (file)
@@ -58,6 +58,7 @@
 #include "log.h"
 #include "link_set.h"
 
+#include <assert.h>
 #include <signal.h>
 #include <sys/types.h>
 #include <net/if.h>
@@ -443,6 +444,9 @@ add_hemu_if(struct olsr_if *iface)
       olsr_syslog(OLSR_LOG_ERR, "Could not initialize socket... exiting!\n\n");
       olsr_cnf->exit_value = EXIT_FAILURE;
       kill(getpid(), SIGINT);
+
+      /* the kill command should not come back, just to be sure */
+      exit(1);
     }
 
   } else {