diff options
author | Russell Belfer <arrbee@arrbee.com> | 2012-02-23 11:16:47 -0800 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2012-02-23 11:16:47 -0800 |
commit | 290f240ee006fef9d65cf987ad5e0d99e956b936 (patch) | |
tree | f0deb9aafad4793ffe4b3db3bf56c636f35ada75 /src/path.c | |
parent | 1ec1de6d43e2f4dcf18ad730efbbfc20d0e4adb0 (diff) | |
download | libgit2-290f240ee006fef9d65cf987ad5e0d99e956b936.tar.gz |
Fix readdir usage across platforms
This fixes the missing readdir_r from win32 and fixes other
platforms to always use the reentrant readdir_r form for reading
directory contents.
Diffstat (limited to 'src/path.c')
-rw-r--r-- | src/path.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/path.c b/src/path.c index 88ea95a97..ec40f4b06 100644 --- a/src/path.c +++ b/src/path.c @@ -491,7 +491,7 @@ int git_path_direach( { ssize_t wd_len; DIR *dir; - struct dirent *de; + struct dirent de_buf, *de; if (git_path_to_dir(path) < GIT_SUCCESS) return git_buf_lasterror(path); @@ -501,7 +501,7 @@ int git_path_direach( if (!dir) return git__throw(GIT_EOSERR, "Failed to process `%s` tree structure. An error occured while opening the directory", path->ptr); - while ((de = readdir(dir)) != NULL) { + while (p_readdir_r(dir, &de_buf, &de) == 0 && de != NULL) { int result; if (is_dot_or_dotdot(de->d_name)) @@ -547,7 +547,7 @@ int git_path_dirload( path_len -= prefix_len; need_slash = (path_len > 0 && path[path_len-1] != '/') ? 1 : 0; - while ((error = readdir_r(dir, &de_buf, &de)) == 0 && de != NULL) { + while ((error = p_readdir_r(dir, &de_buf, &de)) == 0 && de != NULL) { char *entry_path; size_t entry_len; |