diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-07-23 11:19:45 +0000 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-07-23 11:19:45 +0000 |
| commit | 2e073c13f21b2bfb061e3e1ff2569ed3221c0e44 (patch) | |
| tree | 9d91f9f54dd39133125fd5cb7b7ee6e9afe56595 | |
| parent | 22854731920f5fa3927f24efb719083d38214693 (diff) | |
| download | btpd-2e073c13f21b2bfb061e3e1ff2569ed3221c0e44.tar.gz btpd-2e073c13f21b2bfb061e3e1ff2569ed3221c0e44.zip | |
Truncate the pid file when opening it. Now it actually will contain the pid
of the btpd process :)
| -rw-r--r-- | btpd/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/btpd/main.c b/btpd/main.c index 65b0662..f933a51 100644 --- a/btpd/main.c +++ b/btpd/main.c @@ -49,7 +49,7 @@ setup_daemon(int daemonize, const char *dir, const char *log) if (mkdir("torrents", 0777) == -1 && errno != EEXIST) err(1, "Couldn't create torrents subdir"); - if ((pidfd = open("pid", O_CREAT|O_WRONLY, 0666)) == -1) + if ((pidfd = open("pid", O_CREAT|O_TRUNC|O_WRONLY, 0666)) == -1) err(1, "Couldn't open 'pid'"); if (flock(pidfd, LOCK_NB|LOCK_EX) == -1) |