Suppress uvar error messages due to permissions or file not found

su does not reset XDG_RUNTIME_DIR, which means that XDG_RUNTIME_DIR
may point to directories that the user does not have permission
to access. Similarly there is no guarantee that XDG_RUNTIME_DIR
points to a directory that actually exists. Rather than try to
handle these issues, we simply ignore them, effectively disabling
realtime uvar notifications. Fixes #1955.
This commit is contained in:
ridiculousfish 2015-06-01 19:20:25 -07:00
parent c0cf25cf0b
commit 6c53862ff1

View file

@ -1376,7 +1376,13 @@ class universal_notifier_named_pipe_t : public universal_notifier_t
{
// Maybe open failed, maybe mkfifo failed
int err = errno;
report_error(err, L"Unable to make or open a FIFO for universal variables with path '%ls'", vars_path.c_str());
// We explicitly do NOT report an error for ENOENT or EACCESS
// This works around #1955, where $XDG_RUNTIME_DIR may get a bogus value under suc
if (err != ENOENT && err != EPERM)
{
report_error(err, L"Unable to make or open a FIFO for universal variables with path '%ls'", vars_path.c_str());
}
pipe_fd= -1;
}
else
{