svn commit: r220024 - head/lib/libc/gen

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Mar 26 07:17:24 UTC 2011


Author: pjd
Date: Sat Mar 26 07:17:24 2011
New Revision: 220024
URL: http://svn.freebsd.org/changeset/base/220024

Log:
  Don't calculate len too early.

Modified:
  head/lib/libc/gen/directory.3

Modified: head/lib/libc/gen/directory.3
==============================================================================
--- head/lib/libc/gen/directory.3	Sat Mar 26 07:15:57 2011	(r220023)
+++ head/lib/libc/gen/directory.3	Sat Mar 26 07:17:24 2011	(r220024)
@@ -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);


More information about the svn-src-head mailing list