aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2011-03-26 07:17:24 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2011-03-26 07:17:24 +0000
commit6d0d40f668c8ca42187acaa6a5e1ae4d52998875 (patch)
treeeb01cbec21a06d647e88a6b5797d2b26e53ac71b /lib
parent32981eb31b5cd112d69c57cc14b1128eab0479c4 (diff)
Notes
Diffstat (limited to 'lib')
-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 e6d8798e7fb2..992d2fcde520 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);