From 57226d86ff02777b6f68c5b00391015262f65c53 Mon Sep 17 00:00:00 2001 From: Cedric Bail Date: Fri, 15 Jul 2016 17:04:21 -0700 Subject: [PATCH] eio: handle failure due to lack of access right. --- src/lib/eio/eio_monitor.c | 8 ++++++++ src/lib/eio/eio_monitor_inotify.c | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/eio/eio_monitor.c b/src/lib/eio/eio_monitor.c index d30dfd2..5c4eb8f 100644 --- a/src/lib/eio/eio_monitor.c +++ b/src/lib/eio/eio_monitor.c @@ -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); diff --git a/src/lib/eio/eio_monitor_inotify.c b/src/lib/eio/eio_monitor_inotify.c index 2222a56..9279516 100644 --- a/src/lib/eio/eio_monitor_inotify.c +++ b/src/lib/eio/eio_monitor_inotify.c @@ -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; } -- 2.7.4