Warn if can't lock for any reason other than that the file is locked already.

And include the error string in the message.
This commit is contained in:
John Ralls 2019-06-23 11:01:29 -07:00
parent 9ed0174cb0
commit a3871d9ca1

View File

@ -652,14 +652,15 @@ GncXmlBackend::get_file_lock ()
case EACCES: case EACCES:
case EROFS: case EROFS:
case ENOSPC: case ENOSPC:
PWARN ("Unable to create the lockfile %s; may not have write priv",
m_lockfile.c_str());
be_err = ERR_BACKEND_READONLY; be_err = ERR_BACKEND_READONLY;
break; break;
default: default:
be_err = ERR_BACKEND_LOCKED; be_err = ERR_BACKEND_LOCKED;
break; break;
} }
if (errno != EEXIST) // Can't lock, but not because the file is locked
PWARN ("Unable to create the lockfile %s: %s",
m_lockfile.c_str(), strerror(errno));
set_error(be_err); set_error(be_err);
return false; return false;
} }