| 1 | diff --git a/daemon/main/nzbget.cpp b/daemon/main/nzbget.cpp |
| 2 | index 1cfa105..b5cee58 100644 |
| 3 | --- a/daemon/main/nzbget.cpp |
| 4 | +++ b/daemon/main/nzbget.cpp |
| 5 | @@ -19,6 +19,8 @@ |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | +#include <sys/file.h> |
| 10 | + |
| 11 | #include "nzbget.h" |
| 12 | #include "ServerPool.h" |
| 13 | #include "Log.h" |
| 14 | @@ -913,7 +915,7 @@ void NZBGet::Daemonize() |
| 15 | error("Starting daemon failed: could not create lock-file %s", m_options->GetLockFile()); |
| 16 | exit(1); |
| 17 | } |
| 18 | - if (lockf(lfp, F_TLOCK, 0) < 0) |
| 19 | + if (flock(lfp, LOCK_EX) < 0) |
| 20 | { |
| 21 | error("Starting daemon failed: could not acquire lock on lock-file %s", m_options->GetLockFile()); |
| 22 | exit(1); |