Make sure we close stdout, stdin and stderr after forking to background in order to properly detach from the TTY.

This commit is contained in:
Jan Vidar Krey 2009-06-22 18:36:48 +02:00
parent 0d084a5e14
commit ddc91d1640

View File

@ -445,7 +445,13 @@ int main(int argc, char** argv)
} }
else if (ret == 0) else if (ret == 0)
{ {
/* child process */ /* child process - detatch from TTY */
fclose(stdin);
fclose(stdout);
fclose(stderr);
close(0);
close(1);
close(2);
} }
else else
{ {