Starting work on daemonizing the process

pull/4/head
Jacob Windle 2019-04-17 15:04:58 -04:00
parent 7a440dedff
commit 51b2a4e7d0
1 changed files with 11 additions and 0 deletions

11
main.c
View File

@ -85,6 +85,16 @@ int main(int argc, char **argv)
{ {
FILE *hostsFile = NULL; FILE *hostsFile = NULL;
pid_t pid;
pid = fork();
if (pid > 0) {
return 0;
}
/**
if (getuid() != 0) if (getuid() != 0)
{ {
fprintf(stderr, "hb: Must run as root using sudo!\n"); fprintf(stderr, "hb: Must run as root using sudo!\n");
@ -118,4 +128,5 @@ int main(int argc, char **argv)
if (hostsFile != NULL) if (hostsFile != NULL)
fclose(hostsFile); fclose(hostsFile);
**/
} }