it's more similar to EAGAIN than anything to do with permissions.
--HG--
branch : HEAD
off_t start, off_t len)
{
struct flock fl;
+ const char *errstr;
fl.l_type = lock_type;
fl.l_whence = SEEK_SET;
if ((errno == EACCES || errno == EAGAIN || errno == EINTR) &&
cmd == F_SETLK)
return 0;
+
+ errstr = errno != EACCES ? strerror(errno) :
+ "File is locked by another process (EACCES)";
mail_storage_set_critical(index->mbox->ibox.box.storage,
- "fcntl(%s, %s) failed: %m", index->path,
- lock_type == F_UNLCK ? "F_UNLCK" : "F_WRLCK");
+ "fcntl(%s, %s) failed: %s", index->path,
+ lock_type == F_UNLCK ? "F_UNLCK" : "F_WRLCK", errstr);
return -1;
}
return 1;
/* non-blocking lock trying failed */
return 0;
}
- mbox_set_syscall_error(ctx->mbox, "fcntl()");
alarm(0);
+ if (errno != EACCES) {
+ mbox_set_syscall_error(ctx->mbox, "fcntl()");
+ return -1;
+ }
+ mail_storage_set_critical(&ctx->mbox->storage->storage,
+ "fcntl() failed with mbox file %s: "
+ "File is locked by another process (EACCES)",
+ ctx->mbox->path);
return -1;
}
i_fatal("fcntl() locks not supported");
#else
struct flock fl;
+ const char *errstr;
fl.l_type = lock_type;
fl.l_whence = SEEK_SET;
errno = EAGAIN;
return 0;
}
- i_error("fcntl(%s) locking failed for file %s: %m",
+ errstr = errno != EACCES ? strerror(errno) :
+ "File is locked by another process (EACCES)";
+ i_error("fcntl(%s) locking failed for file %s: %s",
lock_type == F_UNLCK ? "unlock" :
lock_type == F_RDLCK ? "read-lock" : "write-lock",
- path);
+ path, errstr);
return -1;
#endif
}