Browse code

Make ffserver daemon chdir()s just after log init. This way a relative path for the logfile is resolved according to the directory where ffserver has been launched, as the user expects.

Originally committed as revision 13911 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini authored on 2008/06/24 04:43:38
Showing 1 changed files
... ...
@@ -4496,7 +4496,6 @@ int main(int argc, char **argv)
4496 4496
         } else {
4497 4497
             /* child */
4498 4498
             setsid();
4499
-            chdir("/");
4500 4499
             close(0);
4501 4500
             open("/dev/null", O_RDWR);
4502 4501
             if (strcmp(logfilename, "-") != 0) {
... ...
@@ -4520,6 +4519,9 @@ int main(int argc, char **argv)
4520 4520
         av_log_set_callback(http_av_log);
4521 4521
     }
4522 4522
 
4523
+    if (ffserver_daemon)
4524
+        chdir("/");
4525
+
4523 4526
     if (http_server() < 0) {
4524 4527
         http_log("Could not start server\n");
4525 4528
         exit(1);