Starting work on daemonizing the process
This commit is contained in:
parent
7a440dedff
commit
51b2a4e7d0
11
main.c
11
main.c
@ -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);
|
||||||
|
**/
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user