This commit is contained in:
Daniel Graziotin 2012-10-19 18:25:10 +02:00
parent a729ab146b
commit 4dbce6bcb3

View file

@ -24,6 +24,7 @@
#include "daemon.h"
#include "global.h"
#include "minunit.h"
#include <syslog.h>
int daemonize = 1;
int verbose = 0;
@ -74,6 +75,13 @@ int main(int argc, char *argv[])
}
}
uid_t uid=getuid(), euid=geteuid();
if (!(uid<0 || uid!=euid)) {
syslog(LOG_INFO, "Mbpfan not started with root privileges. Exiting.");
printf("Mbpfan not started with root privileges. Exiting.\n");
exit(0);
}
// pointer to mbpfan() function in mbpfan.c
void (*fan_control)() = mbpfan;
go_daemon(fan_control);