eio: handle failure due to lack of access right.

This commit is contained in:
Cedric Bail 2016-07-15 17:04:21 -07:00
parent adff89dfc0
commit 57226d86ff
2 changed files with 12 additions and 2 deletions

View File

@ -374,6 +374,14 @@ eio_monitor_stringshared_add(const char *path)
else
eio_monitor_backend_add(monitor);
if (!monitor->backend)
{
WRN("Impossible to create a monitor for '%s'.", monitor->path);
eina_stringshare_del(monitor->path);
free(monitor);
return NULL;
}
eina_hash_direct_add(_eio_monitors, path, monitor);
INF("New monitor on '%s'.", path);

View File

@ -248,9 +248,11 @@ void eio_monitor_backend_add(Eio_Monitor *monitor)
backend->parent = monitor;
backend->hwnd = inotify_add_watch(ecore_main_fd_handler_fd_get(_inotify_fdh), monitor->path, mask);
if (!backend->hwnd)
if (backend->hwnd < 0)
{
eio_monitor_fallback_add(monitor);
if (errno != EACCES)
eio_monitor_fallback_add(monitor);
free(backend);
return;
}