fix(src/util/file_lock): ignore failure to create locks on read-only file systems
EACCES is already ignored when creating lock files. In this case we assume that the file to be locked is part of the system-wide installation. On NixOS however, the file system containing system packages is mounted read-only, and open(2) returns EROFS.
This commit is contained in:
parent
86fc326e08
commit
7e11c5cf6e
1 changed files with 1 additions and 1 deletions
|
@ -78,7 +78,7 @@ file_lock::file_lock(char const * fname, bool exclusive):
|
||||||
m_fname += ".lock";
|
m_fname += ".lock";
|
||||||
m_fd = open(m_fname.c_str(), O_CREAT, 0xFFFF);
|
m_fd = open(m_fname.c_str(), O_CREAT, 0xFFFF);
|
||||||
if (m_fd == -1) {
|
if (m_fd == -1) {
|
||||||
if (errno == EACCES) {
|
if (errno == EACCES || errno == EROFS) {
|
||||||
// We don't have permission to create the file, the folder containing fname is probably readonly.
|
// We don't have permission to create the file, the folder containing fname is probably readonly.
|
||||||
// fname is probably part of the Lean installation in a system directory.
|
// fname is probably part of the Lean installation in a system directory.
|
||||||
// So, we ignore the file_lock in this case.
|
// So, we ignore the file_lock in this case.
|
||||||
|
|
Loading…
Reference in a new issue