Do not fail locking if there is a stale lockfile.

As the lockfiles have PID in the name, there can be no conflict
in the name with other process, so there is no point in using
O_EXCL and it only can fail if there is a stale lockfile from
previous execution that crashed for some reason.
This commit is contained in:
Tomas Mraz 2019-05-02 14:39:01 +02:00
parent 408b8a5482
commit 64d7688acb

View File

@ -141,7 +141,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
int retval;
char buf[32];
fd = open (file, O_CREAT | O_EXCL | O_WRONLY, 0600);
fd = open (file, O_CREAT | O_TRUNC | O_WRONLY, 0600);
if (-1 == fd) {
if (log) {
(void) fprintf (stderr,