diff --git a/ffserver.c b/ffserver.c index bf2bef6e8e8da430be5bd9864199d1298f6eb00a..ad001402d3a2309edd180304b4023bd173cf412d 100644 --- a/ffserver.c +++ b/ffserver.c @@ -4496,7 +4496,6 @@ int main(int argc, char **argv) } else { /* child */ setsid(); - chdir("/"); close(0); open("/dev/null", O_RDWR); if (strcmp(logfilename, "-") != 0) { @@ -4520,6 +4519,9 @@ int main(int argc, char **argv) av_log_set_callback(http_av_log); } + if (ffserver_daemon) + chdir("/"); + if (http_server() < 0) { http_log("Could not start server\n"); exit(1);