#388 prosodyctl getpid tries to open pidfile for writing
getpid from util.prosodyctl tries to open the pidfile for writing (read and append), while reading alone seems to be sufficient. This creates a problem if the pidfile was not created by the prosody user. Attached patch fixes this.
--- prosody/util/prosodyctl.lua.orig 2014-01-23 20:19:32.000000000 +0100
+++ util/prosodyctl.lua 2014-01-23 20:18:58.000000000 +0100
@@ -194,7 +194,7 @@
return false, "no-posix";
- local file, err = io.open(pidfile, "r+");
+ local file, err = io.open(pidfile, "r");
if not file then
return false, "pidfile-read-failed", err;
Hi, thanks for the report.
This is actually intentional (and maybe we should clarify it with a comment). It is so we can lock the file to see if Prosody has a lock on it or not.
It worked fine here with above patch. Is a writable file handle really necessary to acquire a lock?
Testing suggest that the above patch should make it fail with "Bad file descriptor" and won't work unless the lfs.lock() call is also changed to "r".