#74 Require absolute filename for pidfile

closed-accepted
Bugs (14)
5
2012-02-23
2012-02-21
No

Currently, it is possible to launch minidlna like this:

./minidlna -P my.pid -d

which creates the pidfile exactly where the user expects (in the example above -> in the current directory); however, when minidlna runs as a daemon (without "-d"), the process execs a chdir("/"), which causes the pidfile to be written elsewhere ("/my.pid").

This small patch works around the issue by requiring an absolute path as the argument to "-P", which is both safer and wiser.

NOTE1: This patch requires patch 3490290 ("Make DPRINTF macro more robust") or some extra curly braces around the DPRINTF.
NOTE2: It's probably better to exit(1) after printing the error message (at least, that would seem more natural to me, rather than ignoring the error and continuing anyway).

Discussion

  • Justin Maggard

    Justin Maggard - 2012-02-23
    • status: open --> closed-accepted
     
  • Justin Maggard

    Justin Maggard - 2012-02-23

    This patch has been accepted into the main branch. Thanks for contributing!

     

Log in to post a comment.