diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-12-24 20:57:22 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-12-24 20:57:22 +0000 |
commit | 3ff258954cb08b3aee4ddf20b0438f03568d9c15 (patch) | |
tree | 8efdfaebe3bcd5d3e9ce58cdb57df1a0e17015de /bin/ls | |
parent | 314fc043bd09e9b165db5d82f86ddcde18e92fff (diff) |
Kill a race condition which occurs when listing a directory containing
an empty dir non-recursively. By not setting FTS_SKIP on the empty
subdir, a next iteration of the fts_read loop recurses into the
subdir, which might not be empty any more. Report by jacekm@,
troublespot identified by pedro@; ok pedro@ millert@
Diffstat (limited to 'bin/ls')
-rw-r--r-- | bin/ls/ls.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 651233a8320..dab0ec710a2 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.c,v 1.30 2008/09/04 15:44:41 jmc Exp $ */ +/* $OpenBSD: ls.c,v 1.31 2008/12/24 20:57:21 otto Exp $ */ /* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */ /* @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94"; #else -static char rcsid[] = "$OpenBSD: ls.c,v 1.30 2008/09/04 15:44:41 jmc Exp $"; +static char rcsid[] = "$OpenBSD: ls.c,v 1.31 2008/12/24 20:57:21 otto Exp $"; #endif #endif /* not lint */ @@ -384,7 +384,7 @@ traverse(int argc, char *argv[], int options) chp = fts_children(ftsp, ch_options); display(p, chp); - if (!f_recursive && chp != NULL) + if (!f_recursive) (void)fts_set(ftsp, p, FTS_SKIP); break; case FTS_DC: |