diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-11-24 14:32:19 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2020-11-24 14:32:19 +0300 |
commit | 39cf063480f6a378dadc802c174e96112c38c0c0 (patch) | |
tree | 40638090ec42d2fbf44a307fa325b6403522aa44 /src/dir.cc | |
parent | 28301be914dec6da5d1bbd21cd8511cd71b419ee (diff) |
Squashed 'gitstatus/' changes from 90cbb46b..ae213c54
ae213c54 add "pkg" target to makefile
a208375b comments
cdeb063d Give ListDir() the same semantics on BSD as on Linux
git-subtree-dir: gitstatus
git-subtree-split: ae213c540dd6924d3fb153a0860276897c9ba6c8
Diffstat (limited to 'src/dir.cc')
-rw-r--r-- | src/dir.cc | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -211,14 +211,15 @@ char* DirenvConvert(Arena& arena, struct dirent& ent, bool do_convert) { bool ListDir(int dir_fd, Arena& arena, std::vector<char*>& entries, bool precompose_unicode, bool case_sensitive) { - VERIFY((dir_fd = dup(dir_fd)) >= 0); + entries.clear(); + dir_fd = dup(dir_fd); + if (dir_fd < 0) return false; DIR* dir = fdopendir(dir_fd); if (!dir) { CHECK(!close(dir_fd)) << Errno(); - return -1; + return false; } ON_SCOPE_EXIT(&) { CHECK(!closedir(dir)) << Errno(); }; - entries.clear(); while (struct dirent* ent = (errno = 0, readdir(dir))) { if (Dots(ent->d_name)) continue; entries.push_back(DirenvConvert(arena, *ent, precompose_unicode)); |