Skip to content

Commit 73cf8c1

Browse files
committed
fix control flow if kill() command fails to end program
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]>
1 parent ed41d14 commit 73cf8c1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/unix/ifnet.c

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include "log.h"
5959
#include "link_set.h"
6060

61+
#include <assert.h>
6162
#include <signal.h>
6263
#include <sys/types.h>
6364
#include <net/if.h>
@@ -443,6 +444,9 @@ add_hemu_if(struct olsr_if *iface)
443444
olsr_syslog(OLSR_LOG_ERR, "Could not initialize socket... exiting!\n\n");
444445
olsr_cnf->exit_value = EXIT_FAILURE;
445446
kill(getpid(), SIGINT);
447+
448+
/* the kill command should not come back, just to be sure */
449+
exit(1);
446450
}
447451

448452
} else {

0 commit comments

Comments
 (0)