olsr_exit tries to do proper shutdown that cleans up data structures
by raise()ing the SIGTERM signal. This signal then causes olsr_shutdown
to be invoked (only when the signal handler is setup), which will do
the cleanup of the data structures.
According to the man page of raise():
If the signal causes a handler to be called, raise() will return
only after the signal handler has returned.
And since olsr_exit() invokes exit() after raise()ing the signal, there
is no harm in calling it.
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
ifp->olsr_socket = gethemusocket(&sin);
if (ifp->olsr_socket < 0) {
- fprintf(stderr, "Could not initialize socket... exiting!\n\n");
- exit(1);
+ olsr_exit("Could not initialize socket", 1);
}
} else {
New->send_socket = getsocket(0, New);
if (New->olsr_socket < 0) {
- fprintf(stderr, "Could not initialize socket... exiting!\n\n");
- exit(1);
+ olsr_exit("Could not initialize socket", 1);
}
add_olsr_socket(New->olsr_socket, &olsr_input, NULL, NULL, SP_PR_READ);
#include "net_os.h"
#include "net_olsr.h"
#include "ipcalc.h"
+#include "olsr.h"
#if defined WINCE
#define WIDE_STRING(s) L##s
fprintf(stderr, "I have disabled ICMP redirect processing in the registry for you.\n");
fprintf(stderr, "REBOOT NOW, so that these changes take effect. Exiting...\n\n");
- exit(0);
+ olsr_exit(NULL, 0);
}
int