Skip to content

Commit

Permalink
fix control flow if kill() command fails to end program
Browse files Browse the repository at this point in the history
    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 <[email protected]>
  • Loading branch information
HRogge committed Oct 22, 2012
1 parent ed41d14 commit 73cf8c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/unix/ifnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 73cf8c1

Please sign in to comment.