diff --git a/src/main.c b/src/main.c index 4d4cf662..e9efdf65 100644 --- a/src/main.c +++ b/src/main.c @@ -128,7 +128,6 @@ static void _shutdown_subsystems(void) static int _parse_config_opts(int argc, char **argv, char *filename, int size) { int i = 1; - int processID = 0; int config_ok = 0; @@ -137,12 +136,16 @@ static int _parse_config_opts(int argc, char **argv, char *filename, int size) while (i < argc) { if (strcmp(argv[i], "-b") == 0) { #ifndef WIN32 + pid_t pid; fprintf(stdout, "Starting icecast2\nDetaching from the console\n"); - if ((processID = (int)fork()) > 0) { + + pid = fork(); + + if (pid > 0) { /* exit the parent */ exit(0); } - else { + else if(pid < 0) { fprintf(stderr, "FATAL: Unable to fork child!"); exit(1); }