]> git.tuebingen.mpg.de Git - paraslash.git/commit
daemon: Fix log reload for relative paths.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 31 Dec 2017 20:56:35 +0000 (21:56 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 11 Feb 2018 10:28:17 +0000 (11:28 +0100)
commitbde44cf34bd9b334892af6ef4731ecb74b1ab544
tree406e00d8e6856ec9611fef8cc75c0c0d1d75c5d9
parenta047b764498632d977b75b543165383849a591f0
daemon: Fix log reload for relative paths.

If the argument to --logfile is a relative path, it is interpreted
as relative to the current working directory. In daemon mode, the
current working directory is changed to / during startup. Hence,
when para_server re-opens the log file after it received SIGHUP, the
logfile path will now be interpreted as relative to the the root of
the file system.

Fix this by remembering the original current working directory.
Opening "." as recommended in getcwd(3) is not an option here since the
whole point of changing the cwd to / is to prevent the daemon from
keeping the cwd busy.
daemon.c