summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/directory.32
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/gen/directory.3 b/lib/libc/gen/directory.3
index e6d8798..992d2fc 100644
--- a/lib/libc/gen/directory.3
+++ b/lib/libc/gen/directory.3
@@ -207,10 +207,10 @@ see
.Pp
Sample code which searches a directory for entry ``name'' is:
.Bd -literal -offset indent
-len = strlen(name);
dirp = opendir(".");
if (dirp == NULL)
return (ERROR);
+len = strlen(name);
while ((dp = readdir(dirp)) != NULL) {
if (dp->d_namlen == len && strcmp(dp->d_name, name) == 0) {
(void)closedir(dirp);
OpenPOWER on IntegriCloud