Updated removing directory locks
This commit is contained in:
parent
19f9ba962a
commit
97ed2f5985
@ -130,7 +130,9 @@ void ulockdir(char *directory)
|
|||||||
sprintf(lockfile + strlen(lockfile), "%s", LCKNAME);
|
sprintf(lockfile + strlen(lockfile), "%s", LCKNAME);
|
||||||
|
|
||||||
if ((fp = fopen(lockfile, "r")) == NULL) {
|
if ((fp = fopen(lockfile, "r")) == NULL) {
|
||||||
Syslog('-', "Lockfile \"%s\" doesn't exist", lockfile);
|
/*
|
||||||
|
* No lockfile found, so not removed.
|
||||||
|
*/
|
||||||
free(lockfile);
|
free(lockfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -141,6 +143,9 @@ void ulockdir(char *directory)
|
|||||||
if (getpid() != oldpid) {
|
if (getpid() != oldpid) {
|
||||||
WriteError("Attempt to remove lock %s of pid %d", lockfile, oldpid);
|
WriteError("Attempt to remove lock %s of pid %d", lockfile, oldpid);
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
|
* Only remove our own lock.
|
||||||
|
*/
|
||||||
unlink(lockfile);
|
unlink(lockfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user