From 51b2a4e7d0c1e842943015e148831c4f651c10d1 Mon Sep 17 00:00:00 2001 From: jaketothepast Date: Wed, 17 Apr 2019 15:04:58 -0400 Subject: [PATCH] Starting work on daemonizing the process --- main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.c b/main.c index ce1ac40..2df37e0 100644 --- a/main.c +++ b/main.c @@ -85,6 +85,16 @@ int main(int argc, char **argv) { FILE *hostsFile = NULL; + pid_t pid; + + pid = fork(); + + if (pid > 0) { + return 0; + } + + + /** if (getuid() != 0) { fprintf(stderr, "hb: Must run as root using sudo!\n"); @@ -118,4 +128,5 @@ int main(int argc, char **argv) if (hostsFile != NULL) fclose(hostsFile); + **/ }