os: Properly report failure to link lock file
Stop assuming that a failure to link always means that the file indeed exists. In case of other failure (e.g., permissions), the user would get an inconsistent "Can't read lock file" message. Signed-off-by: Olivier Certner <olce.freedesktop@certner.fr>
This commit is contained in:
parent
d66b7ec129
commit
d4b38e1119
|
@ -329,7 +329,7 @@ LockServer(void)
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else if (errno == EEXIST) {
|
||||||
/*
|
/*
|
||||||
* Read the pid from the existing file
|
* Read the pid from the existing file
|
||||||
*/
|
*/
|
||||||
|
@ -374,6 +374,12 @@ LockServer(void)
|
||||||
LockFile, "\tand start again.");
|
LockFile, "\tand start again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
unlink(tmp);
|
||||||
|
FatalError
|
||||||
|
("Linking lock file (%s) in place failed: %s\n",
|
||||||
|
LockFile, strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unlink(tmp);
|
unlink(tmp);
|
||||||
if (!haslock)
|
if (!haslock)
|
||||||
|
|
Loading…
Reference in New Issue