Mercurial > prosody-hg
comparison util/prosodyctl.lua @ 2457:102c81e37878
prosodyctl: Use mode r+ for opening the file so 1) it fails if the file doesn't exist 2) we have write access to lock it
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 13 Jan 2010 00:04:38 +0000 |
| parents | 62aa1b465e05 |
| children | 692b3c6c5bd2 |
comparison
equal
deleted
inserted
replaced
| 2456:260601859c9f | 2457:102c81e37878 |
|---|---|
| 63 local pidfile = config.get("*", "core", "pidfile"); | 63 local pidfile = config.get("*", "core", "pidfile"); |
| 64 if not pidfile then | 64 if not pidfile then |
| 65 return false, "no-pidfile"; | 65 return false, "no-pidfile"; |
| 66 end | 66 end |
| 67 | 67 |
| 68 local file, err = io.open(pidfile, "w"); | 68 local file, err = io.open(pidfile, "r+"); |
| 69 if not file then | 69 if not file then |
| 70 return false, "pidfile-read-failed", err; | 70 return false, "pidfile-read-failed", err; |
| 71 end | 71 end |
| 72 | 72 |
| 73 local locked, err = lfs.lock(file, "w"); | 73 local locked, err = lfs.lock(file, "w"); |
