summaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/dir.c b/dir.c
index 90c2e3e..024e767 100644
--- a/dir.c
+++ b/dir.c
@@ -138,12 +138,10 @@ struct bfs_dir *bfs_opendir(int at_fd, const char *at_path) {
#else
dir->dir = fdopendir(fd);
if (!dir->dir) {
- int error = errno;
if (at_path) {
- close(fd);
+ close_quietly(fd);
}
free(dir);
- errno = error;
return NULL;
}
@@ -280,7 +278,7 @@ int bfs_readdir(struct bfs_dir *dir, struct bfs_dirent *de) {
int bfs_closedir(struct bfs_dir *dir) {
#if __linux__
- int ret = close(dir->fd);
+ int ret = xclose(dir->fd);
#else
int ret = closedir(dir->dir);
#endif