if (error == EACCES) {
error = EAGAIN;
}
- if (pid) {
+ if (pid == getpid()) {
+ VLOG_WARN("%s: cannot lock file because this process has already "
+ "locked it", lock_name);
+ } else if (pid) {
VLOG_WARN("%s: cannot lock file because it is already locked by "
"pid %ld", lock_name, (long int) pid);
} else {
/* Check whether we've already got a lock on that file. */
if (!stat(name, &s)) {
if (lockfile_find(s.st_dev, s.st_ino)) {
+ *pidp = getpid();
return EDEADLK;
}
} else if (errno != ENOENT) {