summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/closedir.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2013-08-18 20:11:34 +0000
committerpjd <pjd@FreeBSD.org>2013-08-18 20:11:34 +0000
commitb717fb9f083afdfbc50a14ced6ddc971ca583f02 (patch)
tree37987e56c42c803d239a91e0492707926feb0d7a /lib/libc/gen/closedir.c
parentab20de7f07aa70c9e4f011a7080d656e3bbc7397 (diff)
downloadFreeBSD-src-b717fb9f083afdfbc50a14ced6ddc971ca583f02.zip
FreeBSD-src-b717fb9f083afdfbc50a14ced6ddc971ca583f02.tar.gz
Implement fdclosedir(3) function, which is equivalent to the closedir(3)
function, but returns directory file descriptor instead of closing it. Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org> Sponsored by: Google Summer of Code 2013
Diffstat (limited to 'lib/libc/gen/closedir.c')
-rw-r--r--lib/libc/gen/closedir.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libc/gen/closedir.c b/lib/libc/gen/closedir.c
index 4b520cc..88ded37 100644
--- a/lib/libc/gen/closedir.c
+++ b/lib/libc/gen/closedir.c
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
* close a directory.
*/
int
-closedir(DIR *dirp)
+fdclosedir(DIR *dirp)
{
int fd;
@@ -65,5 +65,12 @@ closedir(DIR *dirp)
_pthread_mutex_destroy(&dirp->dd_lock);
}
free((void *)dirp);
- return(_close(fd));
+ return (fd);
+}
+
+int
+closedir(DIR *dirp)
+{
+
+ return (_close(fdclosedir(dirp)));
}
OpenPOWER on IntegriCloud