From 0a181fc1b38a62e583f13ccc1550f7ffc8f5896b Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 21 Jul 2018 07:28:05 +0000 Subject: Add unlink_void, change dir_close, prepare for 2.7.0.0 --- src/libstddjb/dir_close.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/libstddjb') 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 #include -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 ; } -- cgit v1.2.3