summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--deps/uv/src/unix/kqueue.c8
-rw-r--r--deps/uv/src/unix/sunos.c2
-rw-r--r--deps/uv/src/unix/udp.c8
-rw-r--r--deps/uv/test/benchmark-getaddrinfo.c4
-rw-r--r--deps/uv/test/benchmark-ping-pongs.c4
-rw-r--r--deps/uv/test/run-tests.c18
-rw-r--r--deps/uv/test/runner-unix.c8
-rw-r--r--deps/uv/test/test-fs-event.c31
-rw-r--r--deps/uv/test/test-getaddrinfo.c4
-rw-r--r--deps/uv/test/test-list.h2
-rw-r--r--deps/uv/test/test-ping-pong.c7
11 files changed, 65 insertions, 31 deletions
diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c
index 73ee696e30..af9078e938 100644
--- a/deps/uv/src/unix/kqueue.c
+++ b/deps/uv/src/unix/kqueue.c
@@ -197,7 +197,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
/* TODO batch up */
struct kevent events[1];
EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0);
- if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) abort();
+ if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL))
+ if (errno != ENOENT)
+ abort();
}
}
@@ -208,7 +210,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
/* TODO batch up */
struct kevent events[1];
EV_SET(events + 0, fd, ev->filter, EV_DELETE, 0, 0, 0);
- if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL)) abort();
+ if (kevent(loop->backend_fd, events, 1, NULL, 0, NULL))
+ if (errno != ENOENT)
+ abort();
}
}
diff --git a/deps/uv/src/unix/sunos.c b/deps/uv/src/unix/sunos.c
index 744fea7775..48b1fca171 100644
--- a/deps/uv/src/unix/sunos.c
+++ b/deps/uv/src/unix/sunos.c
@@ -376,7 +376,7 @@ int uv_fs_event_init(uv_loop_t* loop,
void uv__fs_event_close(uv_fs_event_t* handle) {
- if (handle->fd == PORT_FIRED) {
+ if (handle->fd == PORT_FIRED || handle->fd == PORT_LOADED) {
port_dissociate(handle->loop->fs_fd, PORT_SOURCE_FILE, (uintptr_t)&handle->fo);
}
handle->fd = PORT_DELETED;
diff --git a/deps/uv/src/unix/udp.c b/deps/uv/src/unix/udp.c
index 7a970ba0ea..4b242f6466 100644
--- a/deps/uv/src/unix/udp.c
+++ b/deps/uv/src/unix/udp.c
@@ -446,14 +446,12 @@ static int uv__udp_send(uv_udp_send_t* req,
int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) {
- memset(handle, 0, sizeof *handle);
-
uv__handle_init(loop, (uv_handle_t*)handle, UV_UDP);
- handle->io_watcher.fd = -1;
+ handle->alloc_cb = NULL;
+ handle->recv_cb = NULL;
+ uv__io_init(&handle->io_watcher, uv__udp_io, -1);
ngx_queue_init(&handle->write_queue);
ngx_queue_init(&handle->write_completed_queue);
- uv__io_init(&handle->io_watcher, uv__udp_io, -1);
-
return 0;
}
diff --git a/deps/uv/test/benchmark-getaddrinfo.c b/deps/uv/test/benchmark-getaddrinfo.c
index 07dfa87a0d..8ee0c50add 100644
--- a/deps/uv/test/benchmark-getaddrinfo.c
+++ b/deps/uv/test/benchmark-getaddrinfo.c
@@ -21,11 +21,7 @@
#include "uv.h"
#include "task.h"
-
#include <stdlib.h>
-#include <stdio.h>
-#include <string.h> /* strlen */
-
#define CONCURRENT_CALLS 10
#define TOTAL_CALLS 10000
diff --git a/deps/uv/test/benchmark-ping-pongs.c b/deps/uv/test/benchmark-ping-pongs.c
index 4196b42ff9..e1de83df9d 100644
--- a/deps/uv/test/benchmark-ping-pongs.c
+++ b/deps/uv/test/benchmark-ping-pongs.c
@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <stdio.h>
-#include <string.h> /* strlen */
/* Run the benchmark for this many ms */
#define TIME 5000
@@ -103,8 +102,7 @@ static void pinger_write_ping(pinger_t* pinger) {
uv_write_t* req;
uv_buf_t buf;
- buf.base = (char*)&PING;
- buf.len = strlen(PING);
+ buf = uv_buf_init(PING, sizeof(PING) - 1);
req = malloc(sizeof *req);
if (uv_write(req, (uv_stream_t*) &pinger->tcp, &buf, 1, pinger_write_cb)) {
diff --git a/deps/uv/test/run-tests.c b/deps/uv/test/run-tests.c
index d0e64f05d3..a81c7e5ff6 100644
--- a/deps/uv/test/run-tests.c
+++ b/deps/uv/test/run-tests.c
@@ -19,6 +19,7 @@
* IN THE SOFTWARE.
*/
+#include <errno.h>
#include <stdio.h>
#include <string.h>
@@ -99,7 +100,7 @@ static int maybe_run_test(int argc, char **argv) {
if (strcmp(argv[1], "spawn_helper3") == 0) {
char buffer[256];
- fgets(buffer, sizeof(buffer) - 1, stdin);
+ ASSERT(buffer == fgets(buffer, sizeof(buffer) - 1, stdin));
buffer[sizeof(buffer) - 1] = '\0';
fputs(buffer, stdout);
return 1;
@@ -111,13 +112,20 @@ static int maybe_run_test(int argc, char **argv) {
}
if (strcmp(argv[1], "spawn_helper5") == 0) {
- const char* out = "fourth stdio!\n\0";
+ const char out[] = "fourth stdio!\n";
#ifdef _WIN32
DWORD bytes;
- WriteFile((HANDLE) _get_osfhandle(3), out, strlen(out), &bytes, NULL);
+ WriteFile((HANDLE) _get_osfhandle(3), out, sizeof(out) - 1, &bytes, NULL);
#else
- write(3, out, strlen(out));
- fsync(3);
+ {
+ ssize_t r;
+
+ do
+ r = write(3, out, sizeof(out) - 1);
+ while (r == -1 && errno == EINTR);
+
+ fsync(3);
+ }
#endif
return 1;
}
diff --git a/deps/uv/test/runner-unix.c b/deps/uv/test/runner-unix.c
index 77c68dcd6c..f6ea45e140 100644
--- a/deps/uv/test/runner-unix.c
+++ b/deps/uv/test/runner-unix.c
@@ -24,6 +24,7 @@
#include <stdint.h> /* uintptr_t */
+#include <errno.h>
#include <unistd.h> /* usleep */
#include <string.h> /* strdup */
#include <stdio.h>
@@ -146,8 +147,11 @@ static void* dowait(void* data) {
if (args->pipe[1] >= 0) {
/* Write a character to the main thread to notify it about this. */
- char c = 0;
- write(args->pipe[1], &c, 1);
+ ssize_t r;
+
+ do
+ r = write(args->pipe[1], "", 1);
+ while (r == -1 && errno == EINTR);
}
return NULL;
diff --git a/deps/uv/test/test-fs-event.c b/deps/uv/test/test-fs-event.c
index 67f9421998..249af9acdd 100644
--- a/deps/uv/test/test-fs-event.c
+++ b/deps/uv/test/test-fs-event.c
@@ -296,6 +296,37 @@ TEST_IMPL(fs_event_watch_file_current_dir) {
return 0;
}
+TEST_IMPL(fs_event_no_callback_after_close) {
+ uv_loop_t* loop = uv_default_loop();
+ int r;
+
+ /* Setup */
+ remove("watch_dir/file1");
+ remove("watch_dir/");
+ 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,
+ 0);
+ ASSERT(r != -1);
+
+ uv_close((uv_handle_t*)&fs_event, close_cb);
+ touch_file(loop, "watch_dir/file1");
+ uv_run(loop);
+
+ ASSERT(fs_event_cb_called == 0);
+ ASSERT(close_cb_called == 1);
+
+ /* Cleanup */
+ remove("watch_dir/file1");
+ remove("watch_dir/");
+
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
TEST_IMPL(fs_event_no_callback_on_close) {
uv_loop_t* loop = uv_default_loop();
diff --git a/deps/uv/test/test-getaddrinfo.c b/deps/uv/test/test-getaddrinfo.c
index b88d4b315f..6baf676bd9 100644
--- a/deps/uv/test/test-getaddrinfo.c
+++ b/deps/uv/test/test-getaddrinfo.c
@@ -21,11 +21,7 @@
#include "uv.h"
#include "task.h"
-
#include <stdlib.h>
-#include <stdio.h>
-#include <string.h> /* strlen */
-
#define CONCURRENT_COUNT 10
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index 82a96a0323..9c59a2d47c 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -177,6 +177,7 @@ TEST_DECLARE (fs_event_watch_dir)
TEST_DECLARE (fs_event_watch_file)
TEST_DECLARE (fs_event_watch_file_twice)
TEST_DECLARE (fs_event_watch_file_current_dir)
+TEST_DECLARE (fs_event_no_callback_after_close)
TEST_DECLARE (fs_event_no_callback_on_close)
TEST_DECLARE (fs_event_immediate_close)
TEST_DECLARE (fs_event_close_with_pending_event)
@@ -450,6 +451,7 @@ TASK_LIST_START
TEST_ENTRY (fs_event_watch_file)
TEST_ENTRY (fs_event_watch_file_twice)
TEST_ENTRY (fs_event_watch_file_current_dir)
+ TEST_ENTRY (fs_event_no_callback_after_close)
TEST_ENTRY (fs_event_no_callback_on_close)
TEST_ENTRY (fs_event_immediate_close)
TEST_ENTRY (fs_event_close_with_pending_event)
diff --git a/deps/uv/test/test-ping-pong.c b/deps/uv/test/test-ping-pong.c
index 1b85fa8948..a7b31c73e1 100644
--- a/deps/uv/test/test-ping-pong.c
+++ b/deps/uv/test/test-ping-pong.c
@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <stdio.h>
-#include <string.h> /* strlen */
static int completed_pingers = 0;
@@ -77,11 +76,9 @@ static void pinger_write_ping(pinger_t* pinger) {
uv_write_t *req;
uv_buf_t buf;
- buf.base = (char*)&PING;
- buf.len = strlen(PING);
-
- req = malloc(sizeof(uv_write_t));
+ buf = uv_buf_init(PING, sizeof(PING) - 1);
+ req = malloc(sizeof(*req));
if (uv_write(req, (uv_stream_t*)&pinger->stream.tcp, &buf, 1, pinger_after_write)) {
FATAL("uv_write failed");
}