summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-02-09 14:41:55 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-02-09 14:41:55 +0000
commit87a420ac4a8ce469b56a43e63c58ced04dafbc04 (patch)
treeb38c1220b215a6b87deab7d56608cb8a2862630b /lib
parentbd7d0ce76625e208b1af3213c36c8031fad5eb11 (diff)
improve example by showing how to skip invalid entries; ok millert@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/sys/getdirentries.25
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2
index e41581625a4..3002ddbc169 100644
--- a/lib/libc/sys/getdirentries.2
+++ b/lib/libc/sys/getdirentries.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getdirentries.2,v 1.19 2005/06/18 18:09:42 millert Exp $
+.\" $OpenBSD: getdirentries.2,v 1.20 2007/02/09 14:41:54 otto Exp $
.\" $NetBSD: getdirentries.2,v 1.7 1995/10/12 15:40:50 jtc Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993
@@ -168,7 +168,8 @@ while ((nbytes = getdirentries(fd, buf, bufsize, &base)) > 0) {
cp = buf;
while (cp < ebuf) {
dp = (struct dirent *)cp;
- printf("%s\en", dp->d_name);
+ if (dp->d_fileno != 0)
+ printf("%s\en", dp->d_name);
cp += dp->d_reclen;
}
}