diff options
author | pjd <pjd@FreeBSD.org> | 2011-03-26 07:17:24 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2011-03-26 07:17:24 +0000 |
commit | 0d6974a72124b781ee06810058cc18e1fdc54767 (patch) | |
tree | eb01cbec21a06d647e88a6b5797d2b26e53ac71b /lib/libc | |
parent | 5cdf4e6f59745010af06545c1942d47da5dd3764 (diff) | |
download | FreeBSD-src-0d6974a72124b781ee06810058cc18e1fdc54767.zip FreeBSD-src-0d6974a72124b781ee06810058cc18e1fdc54767.tar.gz |
Don't calculate len too early.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/directory.3 | 2 |
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); |