firewall: Cleanup rules reloading.

This has been messed up a lot because there were multiple
files which indicated that a reload is needed; shell commands
were used to create and remove the indicator file; some
functions were duplicated.
This commit is contained in:
Michael Tremer
2013-10-22 18:53:48 +02:00
parent 0eadfdad4a
commit 0e43079789
5 changed files with 60 additions and 96 deletions

View File

@@ -5,12 +5,21 @@
*
*/
#include <unistd.h>
#include "setuid.h"
int main(int argc, char *argv[]) {
if (!(initsetuid()))
exit(1);
safe_system("/var/ipfire/forward/bin/rules.pl");
int retval = safe_system("/var/ipfire/forward/bin/rules.pl");
/* If rules.pl has been successfully executed, the indicator
* file is removed. */
if (retval == 0) {
unlink("/var/ipfire/forward/reread");
}
return 0;
}