| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: fts.c,v 1.44 2012/03/14 00:25:19 christos Exp $ */ | | 1 | /* $NetBSD: fts.c,v 1.45 2012/09/15 19:31:12 spz 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.44 2012/03/14 00:25:19 christos Exp $"); | | 41 | __RCSID("$NetBSD: fts.c,v 1.45 2012/09/15 19:31:12 spz 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> |
| @@ -123,27 +123,27 @@ fts_open(char * const *argv, int options | | | @@ -123,27 +123,27 @@ fts_open(char * const *argv, int options |
123 | size_t nitems; | | 123 | size_t nitems; |
124 | FTSENT *parent, *tmp = NULL; /* pacify gcc */ | | 124 | FTSENT *parent, *tmp = NULL; /* pacify gcc */ |
125 | size_t len; | | 125 | size_t len; |
126 | | | 126 | |
127 | _DIAGASSERT(argv != NULL); | | 127 | _DIAGASSERT(argv != NULL); |
128 | | | 128 | |
129 | /* Options check. */ | | 129 | /* Options check. */ |
130 | if (options & ~FTS_OPTIONMASK) { | | 130 | if (options & ~FTS_OPTIONMASK) { |
131 | errno = EINVAL; | | 131 | errno = EINVAL; |
132 | return (NULL); | | 132 | return (NULL); |
133 | } | | 133 | } |
134 | | | 134 | |
135 | /* Allocate/initialize the stream */ | | 135 | /* Allocate/initialize the stream */ |
136 | if ((sp = malloc((unsigned int)sizeof(FTS))) == NULL) | | 136 | if ((sp = malloc(sizeof(FTS))) == NULL) |
137 | return (NULL); | | 137 | return (NULL); |
138 | memset(sp, 0, sizeof(FTS)); | | 138 | memset(sp, 0, sizeof(FTS)); |
139 | sp->fts_compar = compar; | | 139 | sp->fts_compar = compar; |
140 | sp->fts_options = options; | | 140 | sp->fts_options = options; |
141 | | | 141 | |
142 | /* Logical walks turn on NOCHDIR; symbolic links are too hard. */ | | 142 | /* Logical walks turn on NOCHDIR; symbolic links are too hard. */ |
143 | if (ISSET(FTS_LOGICAL)) | | 143 | if (ISSET(FTS_LOGICAL)) |
144 | SET(FTS_NOCHDIR); | | 144 | SET(FTS_NOCHDIR); |
145 | | | 145 | |
146 | /* | | 146 | /* |
147 | * Start out with 1K of path space, and enough, in any case, | | 147 | * Start out with 1K of path space, and enough, in any case, |
148 | * to hold the user's paths. | | 148 | * to hold the user's paths. |
149 | */ | | 149 | */ |