diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-21 07:28:05 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2018-07-21 07:28:05 +0000 |
commit | 0a181fc1b38a62e583f13ccc1550f7ffc8f5896b (patch) | |
tree | 3317e6a0288817585f26e7a4140efdf76b6f6768 /src/libstddjb | |
parent | f09ad31e00c22086863b95d3b6cb8eeadfdcdef7 (diff) | |
download | skalibs-0a181fc1b38a62e583f13ccc1550f7ffc8f5896b.tar.xz |
Add unlink_void, change dir_close, prepare for 2.7.0.0
Diffstat (limited to 'src/libstddjb')
-rw-r--r-- | src/libstddjb/dir_close.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/libstddjb/dir_close.c b/src/libstddjb/dir_close.c index 1b7b16a..4c5d0cf 100644 --- a/src/libstddjb/dir_close.c +++ b/src/libstddjb/dir_close.c @@ -3,12 +3,13 @@ #include <errno.h> #include <skalibs/direntry.h> -int dir_close (DIR *dir) +void dir_close (DIR *dir) { - unsigned int done = 0 ; -doit: - done++ ; - if (!closedir(dir)) return 0 ; - if (errno == EINTR) goto doit ; - return ((errno == EBADF) && (done > 1)) ? 0 : -1 ; + int e = errno ; + for (;;) + { + if (closedir(dir) == 0) break ; + if (errno != EINTR) break ; + } + errno = e ; } |