diff options
author | wes <wes@FreeBSD.org> | 1999-11-29 06:12:22 +0000 |
---|---|---|
committer | wes <wes@FreeBSD.org> | 1999-11-29 06:12:22 +0000 |
commit | 34470507ed5ed8ed1faf48d8c3f3f9953f91e2cb (patch) | |
tree | f03617d19400e616c702c277e6bd546fc749960b /lib/libc/gen/readdir.c | |
parent | 0daa4a3235b2e87c820807219f6b1813980b1af4 (diff) | |
download | FreeBSD-src-34470507ed5ed8ed1faf48d8c3f3f9953f91e2cb.zip FreeBSD-src-34470507ed5ed8ed1faf48d8c3f3f9953f91e2cb.tar.gz |
Provide a man page for Alfreds lovely readdir_r function. Also
fixed a minor indentation nit and added a few {}s to make readdir_r
easier on old eyes.
Diffstat (limited to 'lib/libc/gen/readdir.c')
-rw-r--r-- | lib/libc/gen/readdir.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c index 74246b9..9b8c175 100644 --- a/lib/libc/gen/readdir.c +++ b/lib/libc/gen/readdir.c @@ -95,8 +95,9 @@ readdir_r(dirp, entry, result) return EBADF; } #ifdef _THREAD_SAFE - if ((ret = _FD_LOCK(dirp->dd_fd, FD_READ, NULL)) != 0) + if ((ret = _FD_LOCK(dirp->dd_fd, FD_READ, NULL)) != 0) { return ret; + } #endif errno = 0; dp = readdir(dirp); @@ -106,14 +107,16 @@ readdir_r(dirp, entry, result) #endif return errno; } - if (dp != NULL) + if (dp != NULL) { memcpy(entry, dp, sizeof *entry); + } #ifdef _THREAD_SAFE _FD_UNLOCK(dirp->dd_fd, FD_READ); #endif - if (dp != NULL) - *result = entry; - else + if (dp != NULL) { + *result = entry; + } else { *result = NULL; + } return 0; } |