diff options
author | 2017-09-18 15:57:02 +0000 | |
---|---|---|
committer | 2017-09-18 15:57:02 +0000 | |
commit | e2ff04dfbe00fdaf691b40d28dd23bc1e697e8c8 (patch) | |
tree | f23858028a0f123f8b13d2e7e7b107732b7cbe42 /lib/libc | |
parent | Avoid race in relayd test that uses an invalid chunked header. Wait (diff) | |
download | wireguard-openbsd-e2ff04dfbe00fdaf691b40d28dd23bc1e697e8c8.tar.xz wireguard-openbsd-e2ff04dfbe00fdaf691b40d28dd23bc1e697e8c8.zip |
Document readdir_r() return value and update style of the example
code. Adapted from a diff by Ross L Richardson.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/directory.3 | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/libc/gen/directory.3 b/lib/libc/gen/directory.3 index 160ac912621..f892c4a9b88 100644 --- a/lib/libc/gen/directory.3 +++ b/lib/libc/gen/directory.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: directory.3,v 1.24 2015/11/10 23:48:18 jmc Exp $ +.\" $OpenBSD: directory.3,v 1.25 2017/09/18 15:57:02 millert Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: November 10 2015 $ +.Dd $Mdocdate: September 18 2017 $ .Dt OPENDIR 3 .Os .Sh NAME @@ -129,6 +129,9 @@ must be large enough for a dirent with a array member containing at least .Dv NAME_MAX plus one elements. +.Fn readdir_r +returns 0 on success, or an error number if an error occurs; see +.Sx ERRORS . On successful return, the pointer returned at .Fa "*result" will have the same value as the argument @@ -200,12 +203,12 @@ if (dirp) { while ((dp = readdir(dirp)) != NULL) if (dp->d_namlen == len && !strcmp(dp->d_name, name)) { - (void)closedir(dirp); - return (FOUND); + closedir(dirp); + return FOUND; } - (void)closedir(dirp); + closedir(dirp); } -return (NOT_FOUND); +return NOT_FOUND; .Ed .Sh ERRORS The |