Permalink
Browse files

uv: upgrade to 0fb3769

  • Loading branch information...
1 parent 818f0cb commit 52eaac438269b1c391bf10496e2e52bf74cca35d @bnoordhuis bnoordhuis committed Nov 3, 2011
Showing with 38 additions and 1 deletion.
  1. +4 −0 deps/uv/src/unix/core.c
  2. +3 −1 deps/uv/src/win/fs-event.c
  3. +29 −0 deps/uv/test/test-fs-event.c
  4. +2 −0 deps/uv/test/test-list.h
View
@@ -599,7 +599,11 @@ static int uv_getaddrinfo_done(eio_req* req) {
if (handle->retcode == 0) {
/* OK */
+#if EAI_NODATA /* FreeBSD deprecated EAI_NODATA */
} else if (handle->retcode == EAI_NONAME || handle->retcode == EAI_NODATA) {
+#else
+ } else if (handle->retcode == EAI_NONAME) {
+#endif
uv__set_sys_error(handle->loop, ENOENT); /* FIXME compatibility hack */
} else {
handle->loop->last_err.code = UV_EADDRINFO;
@@ -353,7 +353,9 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
offset = file_info->NextEntryOffset;
} while(offset);
} else {
- handle->cb(handle, NULL, UV_CHANGE, 0);
+ if (!(handle->flags & UV_HANDLE_CLOSING)) {
+ handle->cb(handle, NULL, UV_CHANGE, 0);
+ }
}
} else {
uv__set_sys_error(loop, GET_REQ_ERROR(req));
@@ -235,3 +235,32 @@ TEST_IMPL(fs_event_watch_file_current_dir) {
r = uv_fs_unlink(loop, &fs_req, "watch_file", NULL);
return 0;
}
+
+
+TEST_IMPL(fs_event_no_callback_on_close) {
+ uv_fs_t fs_req;
+ uv_loop_t* loop = uv_default_loop();
+ int r;
+
+ /* Setup */
+ uv_fs_unlink(loop, &fs_req, "watch_dir/file1", NULL);
+ uv_fs_rmdir(loop, &fs_req, "watch_dir", NULL);
+ create_dir(loop, "watch_dir");
+ create_file(loop, "watch_dir/file1");
+
+ r = uv_fs_event_init(loop, &fs_event, "watch_dir/file1", fs_event_cb_file);
+ ASSERT(r != -1);
+
+ uv_close((uv_handle_t*)&fs_event, close_cb);
+
+ uv_run(loop);
+
+ ASSERT(fs_event_cb_called == 0);
+ ASSERT(close_cb_called == 1);
+
+ /* Cleanup */
+ r = uv_fs_unlink(loop, &fs_req, "watch_dir/file1", NULL);
+ r = uv_fs_rmdir(loop, &fs_req, "watch_dir", NULL);
+
+ return 0;
+}
View
@@ -106,6 +106,7 @@ TEST_DECLARE (fs_stat_missing_path)
TEST_DECLARE (fs_event_watch_dir)
TEST_DECLARE (fs_event_watch_file)
TEST_DECLARE (fs_event_watch_file_current_dir)
+TEST_DECLARE (fs_event_no_callback_on_close)
TEST_DECLARE (fs_readdir_empty_dir)
TEST_DECLARE (fs_readdir_file)
TEST_DECLARE (fs_open_dir)
@@ -252,6 +253,7 @@ TASK_LIST_START
TEST_ENTRY (fs_event_watch_dir)
TEST_ENTRY (fs_event_watch_file)
TEST_ENTRY (fs_event_watch_file_current_dir)
+ TEST_ENTRY (fs_event_no_callback_on_close)
TEST_ENTRY (fs_readdir_empty_dir)
TEST_ENTRY (fs_readdir_file)
TEST_ENTRY (fs_open_dir)

0 comments on commit 52eaac4

Please sign in to comment.