| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: fts.c,v 1.34 2008/09/27 15:12:00 lukem Exp $ */ | | 1 | /* $NetBSD: fts.c,v 1.35 2009/01/03 06:12:14 lukem Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1990, 1993, 1994 | | 4 | * Copyright (c) 1990, 1993, 1994 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -28,27 +28,27 @@ | | | @@ -28,27 +28,27 @@ |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 | * SUCH DAMAGE. | | 29 | * SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #if HAVE_NBTOOL_CONFIG_H | | 32 | #if HAVE_NBTOOL_CONFIG_H |
33 | #include "nbtool_config.h" | | 33 | #include "nbtool_config.h" |
34 | #endif | | 34 | #endif |
35 | | | 35 | |
36 | #include <sys/cdefs.h> | | 36 | #include <sys/cdefs.h> |
37 | #if defined(LIBC_SCCS) && !defined(lint) | | 37 | #if defined(LIBC_SCCS) && !defined(lint) |
38 | #if 0 | | 38 | #if 0 |
39 | static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; | | 39 | static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; |
40 | #else | | 40 | #else |
41 | __RCSID("$NetBSD: fts.c,v 1.34 2008/09/27 15:12:00 lukem Exp $"); | | 41 | __RCSID("$NetBSD: fts.c,v 1.35 2009/01/03 06:12:14 lukem Exp $"); |
42 | #endif | | 42 | #endif |
43 | #endif /* LIBC_SCCS and not lint */ | | 43 | #endif /* LIBC_SCCS and not lint */ |
44 | | | 44 | |
45 | #include "namespace.h" | | 45 | #include "namespace.h" |
46 | #include <sys/param.h> | | 46 | #include <sys/param.h> |
47 | #include <sys/stat.h> | | 47 | #include <sys/stat.h> |
48 | | | 48 | |
49 | #include <assert.h> | | 49 | #include <assert.h> |
50 | #include <dirent.h> | | 50 | #include <dirent.h> |
51 | #include <errno.h> | | 51 | #include <errno.h> |
52 | #include <fcntl.h> | | 52 | #include <fcntl.h> |
53 | #include <fts.h> | | 53 | #include <fts.h> |
54 | #include <stdlib.h> | | 54 | #include <stdlib.h> |
| @@ -246,27 +246,27 @@ int | | | @@ -246,27 +246,27 @@ int |
246 | fts_close(FTS *sp) | | 246 | fts_close(FTS *sp) |
247 | { | | 247 | { |
248 | FTSENT *freep, *p; | | 248 | FTSENT *freep, *p; |
249 | int saved_errno = 0; | | 249 | int saved_errno = 0; |
250 | | | 250 | |
251 | _DIAGASSERT(sp != NULL); | | 251 | _DIAGASSERT(sp != NULL); |
252 | | | 252 | |
253 | /* | | 253 | /* |
254 | * This still works if we haven't read anything -- the dummy structure | | 254 | * This still works if we haven't read anything -- the dummy structure |
255 | * points to the root list, so we step through to the end of the root | | 255 | * points to the root list, so we step through to the end of the root |
256 | * list which has a valid parent pointer. | | 256 | * list which has a valid parent pointer. |
257 | */ | | 257 | */ |
258 | if (sp->fts_cur) { | | 258 | if (sp->fts_cur) { |
259 | if (ISSET(FTS_SYMFOLLOW)) | | 259 | if (sp->fts_cur->fts_flags & FTS_SYMFOLLOW) |
260 | (void)close(sp->fts_cur->fts_symfd); | | 260 | (void)close(sp->fts_cur->fts_symfd); |
261 | for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) { | | 261 | for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) { |
262 | freep = p; | | 262 | freep = p; |
263 | p = p->fts_link ? p->fts_link : p->fts_parent; | | 263 | p = p->fts_link ? p->fts_link : p->fts_parent; |
264 | fts_free(freep); | | 264 | fts_free(freep); |
265 | } | | 265 | } |
266 | fts_free(p); | | 266 | fts_free(p); |
267 | } | | 267 | } |
268 | | | 268 | |
269 | /* Free up child linked list, sort array, path buffer. */ | | 269 | /* Free up child linked list, sort array, path buffer. */ |
270 | if (sp->fts_child) | | 270 | if (sp->fts_child) |
271 | fts_lfree(sp->fts_child); | | 271 | fts_lfree(sp->fts_child); |
272 | if (sp->fts_array) | | 272 | if (sp->fts_array) |