mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-25 10:22:59 +02:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user