summaryrefslogtreecommitdiff
path: root/src/lib/eio/eio_monitor_cocoa.c
diff options
context:
space:
mode:
authorpierre lamot <pierre.lamot@openwide.fr>2015-03-03 17:01:03 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-17 10:42:51 +0100
commitde767cabfaf84f262c785ce468508f6ed52cc009 (patch)
tree880db66d1636587a6b8a29a3fc44ff88375eeb6a /src/lib/eio/eio_monitor_cocoa.c
parentc380812496f226d6d3243a2b1c083f6aed8a4dc9 (diff)
eio: don't restart a monitor on MacOSX when every paths have been removed.
This patch check that when a monitor is removed the FSEvent service, it is not restarted if there is no more paths to monitor. This was generating an error message from FSEvent. Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/lib/eio/eio_monitor_cocoa.c')
-rw-r--r--src/lib/eio/eio_monitor_cocoa.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/lib/eio/eio_monitor_cocoa.c b/src/lib/eio/eio_monitor_cocoa.c
index ea1d793..8cadeaf 100644
--- a/src/lib/eio/eio_monitor_cocoa.c
+++ b/src/lib/eio/eio_monitor_cocoa.c
@@ -195,7 +195,6 @@ _eio_get_monitor_path(const char *path, char **monpath, char **fullpath)
195 char realPath[PATH_MAX]; 195 char realPath[PATH_MAX];
196 char *realPathOk; 196 char *realPathOk;
197 char *dname = NULL; 197 char *dname = NULL;
198 char *fname = NULL;
199 struct stat sb; 198 struct stat sb;
200 199
201 realPathOk = realpath(path, realPath); 200 realPathOk = realpath(path, realPath);
@@ -383,15 +382,18 @@ void eio_monitor_backend_del(Eio_Monitor *monitor)
383 CFArrayRemoveValueAtIndex(_paths_to_watch, idx); 382 CFArrayRemoveValueAtIndex(_paths_to_watch, idx);
384 } 383 }
385 384
386 _stream = FSEventStreamCreate(NULL, 385 if (CFArrayGetCount(_paths_to_watch) > 0)
387 _eio_fsevent_cb, 386 {
388 NULL, 387 _stream = FSEventStreamCreate(NULL,
389 _paths_to_watch, 388 _eio_fsevent_cb,
390 eventid, 389 NULL,
391 _latency, 390 _paths_to_watch,
392 kFSEventStreamCreateFlagFileEvents 391 eventid,
393 | kFSEventStreamCreateFlagNoDefer 392 _latency,
394 ); 393 kFSEventStreamCreateFlagFileEvents
394 | kFSEventStreamCreateFlagNoDefer
395 );
396 }
395 backend = monitor->backend; 397 backend = monitor->backend;
396 monitor->backend = NULL; 398 monitor->backend = NULL;
397 if (!backend) return; 399 if (!backend) return;