Skip to content

Instantly share code, notes, and snippets.

@indutny indutny/1.diff Secret
Last active Aug 29, 2015

Embed
What would you like to do?
diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c
index 2dd0fe9..fc7413f 100644
--- a/deps/uv/src/unix/fs.c
+++ b/deps/uv/src/unix/fs.c
@@ -311,6 +311,7 @@ static ssize_t uv__fs_readdir(uv_fs_t* req) {
dents = NULL;
n = scandir(req->path, &dents, uv__fs_readdir_filter, alphasort);
+ req->nbufs = 0;
if (n == 0)
goto out; /* osx still needs to deallocate some memory */
@@ -319,7 +320,6 @@ static ssize_t uv__fs_readdir(uv_fs_t* req) {
/* NOTE: We will use nbufs as an index field */
req->ptr = dents;
- req->nbufs = 0;
return n;
diff --git a/src/node_file.cc b/src/node_file.cc
index 8962f86..244111b 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -213,6 +213,7 @@ static void After(uv_fs_t *req) {
for (int i = 0; ; i++) {
uv_dirent_t ent;
+ fprintf(stdout, "readdir %p %d\n", req->ptr, req->nbufs);
r = uv_fs_readdir_next(req, &ent);
if (r == UV_EOF)
break;
@tjfontaine

This comment has been minimized.

Copy link

commented Sep 23, 2014

readdir 0x100e337f0 0 4
readdir 0x100e337f0 1 4
readdir 0x100e337f0 2 4
readdir 0x100e337f0 3 4
readdir 0x100e337f0 4 4
readdir 0x1023beaf0 0 2
readdir 0x1023beaf0 1 2
readdir 0x1023beaf0 2 2
readdir 0x0 983040 0
Segmentation fault: 11 (core dumped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.