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:
@@ -141,7 +141,7 @@ static int do_lock_file (const char *file, const char *lock, bool log)
|
|||||||
int retval;
|
int retval;
|
||||||
char buf[32];
|
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 (-1 == fd) {
|
||||||
if (log) {
|
if (log) {
|
||||||
(void) fprintf (stderr,
|
(void) fprintf (stderr,
|
||||||
|
Reference in New Issue
Block a user