Open universal variable lock file read/write and ignore errors

Closes #2149.
This commit is contained in:
David Adam 2015-07-03 15:31:03 +08:00
parent 322a611872
commit e60db8075c

View file

@ -698,7 +698,7 @@ bool env_universal_t::open_and_acquire_lock(const wcstring &path, int *out_fd)
*/ */
int result_fd = -1; int result_fd = -1;
bool needs_lock = true; bool needs_lock = true;
int flags = O_RDONLY | O_CREAT; int flags = O_RDWR | O_CREAT;
#ifdef O_EXLOCK #ifdef O_EXLOCK
flags |= O_EXLOCK; flags |= O_EXLOCK;
needs_lock = false; needs_lock = false;
@ -741,8 +741,7 @@ bool env_universal_t::open_and_acquire_lock(const wcstring &path, int *out_fd)
/* error */ /* error */
if (errno != EINTR) if (errno != EINTR)
{ {
int err = errno; /* Do nothing per #2149 */
report_error(err, L"Unable to lock universal variable file '%ls'", path.c_str());
break; break;
} }
} }