From 1579788c50ad6ab8044c734d7c4118e3c573259c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 12 May 2014 23:46:56 +0200 Subject: [PATCH] unix, windows: avoid error in uv_fs_event_stop For consistency with other handle types, if stop is called while the handle wasn't started yet, it's a no-op. --- src/unix/kqueue.c | 2 +- src/unix/linux-inotify.c | 2 +- src/unix/sunos.c | 2 +- src/win/fs-event.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c index 77064175..b4f9f5d8 100644 --- a/src/unix/kqueue.c +++ b/src/unix/kqueue.c @@ -377,7 +377,7 @@ fallback: int uv_fs_event_stop(uv_fs_event_t* handle) { if (!uv__is_active(handle)) - return -EINVAL; + return 0; uv__handle_stop(handle); diff --git a/src/unix/linux-inotify.c b/src/unix/linux-inotify.c index 20bc1735..2ecc5ebf 100644 --- a/src/unix/linux-inotify.c +++ b/src/unix/linux-inotify.c @@ -231,7 +231,7 @@ int uv_fs_event_stop(uv_fs_event_t* handle) { struct watcher_list* w; if (!uv__is_active(handle)) - return -EINVAL; + return 0; w = find_watcher(handle->loop, handle->wd); assert(w != NULL); diff --git a/src/unix/sunos.c b/src/unix/sunos.c index b8a39c70..a630dba7 100644 --- a/src/unix/sunos.c +++ b/src/unix/sunos.c @@ -431,7 +431,7 @@ int uv_fs_event_start(uv_fs_event_t* handle, int uv_fs_event_stop(uv_fs_event_t* handle) { if (!uv__is_active(handle)) - return -EINVAL; + return 0; if (handle->fd == PORT_FIRED || handle->fd == PORT_LOADED) { port_dissociate(handle->loop->fs_fd, diff --git a/src/win/fs-event.c b/src/win/fs-event.c index f3de5756..7ad99a88 100644 --- a/src/win/fs-event.c +++ b/src/win/fs-event.c @@ -290,7 +290,7 @@ error: int uv_fs_event_stop(uv_fs_event_t* handle) { if (!uv__is_active(handle)) - return UV_EINVAL; + return 0; if (handle->dir_handle != INVALID_HANDLE_VALUE) { CloseHandle(handle->dir_handle);