1 | /* confdefs.h */ |
---|
2 | #define PACKAGE_NAME "GNU M4" |
---|
3 | #define PACKAGE_TARNAME "m4" |
---|
4 | #define PACKAGE_VERSION "1.4.19" |
---|
5 | #define PACKAGE_STRING "GNU M4 1.4.19" |
---|
6 | #define PACKAGE_BUGREPORT "bug-m4@gnu.org" |
---|
7 | #define PACKAGE_URL "https://www.gnu.org/software/m4/" |
---|
8 | #define PACKAGE "m4" |
---|
9 | #define VERSION "1.4.19" |
---|
10 | #define HAVE_STDIO_H 1 |
---|
11 | #define HAVE_STDLIB_H 1 |
---|
12 | #define HAVE_STRING_H 1 |
---|
13 | #define HAVE_INTTYPES_H 1 |
---|
14 | #define HAVE_STDINT_H 1 |
---|
15 | #define HAVE_STRINGS_H 1 |
---|
16 | #define HAVE_SYS_STAT_H 1 |
---|
17 | #define HAVE_SYS_TYPES_H 1 |
---|
18 | #define HAVE_UNISTD_H 1 |
---|
19 | #define HAVE_WCHAR_H 1 |
---|
20 | #define HAVE_PTHREAD_H 1 |
---|
21 | #define HAVE_SYS_PARAM_H 1 |
---|
22 | #define HAVE_SYS_SOCKET_H 1 |
---|
23 | #define HAVE_DIRENT_H 1 |
---|
24 | #define HAVE_GETOPT_H 1 |
---|
25 | #define HAVE_SYS_CDEFS_H 1 |
---|
26 | #define HAVE_ICONV_H 1 |
---|
27 | #define HAVE_LIMITS_H 1 |
---|
28 | #define HAVE_WCTYPE_H 1 |
---|
29 | #define HAVE_LANGINFO_H 1 |
---|
30 | #define HAVE_XLOCALE_H 1 |
---|
31 | #define HAVE_MATH_H 1 |
---|
32 | #define HAVE_SYS_MMAN_H 1 |
---|
33 | #define HAVE_SYS_TIME_H 1 |
---|
34 | #define HAVE_SYS_RANDOM_H 1 |
---|
35 | #define HAVE_SYS_WAIT_H 1 |
---|
36 | #define HAVE_ARPA_INET_H 1 |
---|
37 | #define HAVE_SEMAPHORE_H 1 |
---|
38 | #define HAVE_NETDB_H 1 |
---|
39 | #define HAVE_NETINET_IN_H 1 |
---|
40 | #define HAVE_SYS_SELECT_H 1 |
---|
41 | #define HAVE_SYS_IOCTL_H 1 |
---|
42 | #define HAVE_SYS_UIO_H 1 |
---|
43 | #define STDC_HEADERS 1 |
---|
44 | #define _ALL_SOURCE 1 |
---|
45 | #define _DARWIN_C_SOURCE 1 |
---|
46 | #define _GNU_SOURCE 1 |
---|
47 | #define _HPUX_ALT_XOPEN_SOCKET_API 1 |
---|
48 | #define _NETBSD_SOURCE 1 |
---|
49 | #define _OPENBSD_SOURCE 1 |
---|
50 | #define _POSIX_PTHREAD_SEMANTICS 1 |
---|
51 | #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 |
---|
52 | #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 |
---|
53 | #define __STDC_WANT_IEC_60559_DFP_EXT__ 1 |
---|
54 | #define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 |
---|
55 | #define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 |
---|
56 | #define __STDC_WANT_LIB_EXT2__ 1 |
---|
57 | #define __STDC_WANT_MATH_SPEC_FUNCS__ 1 |
---|
58 | #define _TANDEM_SOURCE 1 |
---|
59 | #define __EXTENSIONS__ 1 |
---|
60 | #define HAVE_FSEEKO 1 |
---|
61 | #define GNULIB_REGEX_SINGLE_THREAD 1 |
---|
62 | #define GNULIB_MBRTOWC_SINGLE_THREAD 1 |
---|
63 | #define GNULIB_WCHAR_SINGLE_LOCALE 1 |
---|
64 | #define HAVE_UNSIGNED_LONG_LONG_INT 1 |
---|
65 | #define HAVE_LONG_LONG_INT 1 |
---|
66 | #define HAVE_UNSIGNED_LONG_LONG_INT 1 |
---|
67 | #define HAVE_ALLOCA_H 1 |
---|
68 | #define HAVE_ALLOCA 1 |
---|
69 | #define HAVE_BTOWC 1 |
---|
70 | #define HAVE_REALPATH 1 |
---|
71 | #define HAVE_LSTAT 1 |
---|
72 | #define HAVE_FCHDIR 1 |
---|
73 | #define HAVE_FCNTL 1 |
---|
74 | #define HAVE_SYMLINK 1 |
---|
75 | #define HAVE_FPURGE 1 |
---|
76 | #define HAVE_GETDTABLESIZE 1 |
---|
77 | #define HAVE_GETPROGNAME 1 |
---|
78 | #define HAVE_ISWCNTRL 1 |
---|
79 | #define HAVE_ISWBLANK 1 |
---|
80 | #define HAVE_USELOCALE 1 |
---|
81 | #define HAVE_NEWLOCALE 1 |
---|
82 | #define HAVE_DUPLOCALE 1 |
---|
83 | #define HAVE_FREELOCALE 1 |
---|
84 | #define HAVE_MBSINIT 1 |
---|
85 | #define HAVE_MBRTOWC 1 |
---|
86 | #define HAVE_MPROTECT 1 |
---|
87 | #define HAVE_MKSTEMP 1 |
---|
88 | #define HAVE_NL_LANGINFO 1 |
---|
89 | #define HAVE_PIPE 1 |
---|
90 | #define HAVE_READLINK 1 |
---|
91 | #define HAVE_ISBLANK 1 |
---|
92 | #define HAVE_ISWCTYPE 1 |
---|
93 | #define HAVE_LINK 1 |
---|
94 | #define HAVE_GETUID 1 |
---|
95 | #define HAVE_GETEUID 1 |
---|
96 | #define HAVE_GETGID 1 |
---|
97 | #define HAVE_GETEGID 1 |
---|
98 | #define HAVE_SIGACTION 1 |
---|
99 | #define HAVE_SIGALTSTACK 1 |
---|
100 | #define HAVE_SIGINTERRUPT 1 |
---|
101 | #define HAVE_SETRLIMIT 1 |
---|
102 | #define HAVE_GETRLIMIT 1 |
---|
103 | #define HAVE_SNPRINTF 1 |
---|
104 | #define HAVE_STRERROR_R 1 |
---|
105 | #define HAVE_WCRTOMB 1 |
---|
106 | #define HAVE_WCWIDTH 1 |
---|
107 | #define HAVE_FTRUNCATE 1 |
---|
108 | #define HAVE_GETTIMEOFDAY 1 |
---|
109 | #define HAVE_PTHREAD_SIGMASK 1 |
---|
110 | #define HAVE_SETENV 1 |
---|
111 | #define HAVE_SLEEP 1 |
---|
112 | #define HAVE_CATGETS 1 |
---|
113 | #define HAVE_SHUTDOWN 1 |
---|
114 | #define HAVE_WCTOB 1 |
---|
115 | #define HAVE_LANGINFO_CODESET 1 |
---|
116 | #define HAVE_MALLOC_POSIX 1 |
---|
117 | #define HAVE_GETCWD 1 |
---|
118 | #define HAVE_DECL_STRERROR_R 1 |
---|
119 | #define HAVE_STRERROR_R 1 |
---|
120 | #define HAVE_SIG_ATOMIC_T 1 |
---|
121 | #define HAVE_DECL_FCHDIR 1 |
---|
122 | #define HAVE_WORKING_O_NOATIME 0 |
---|
123 | #define HAVE_WORKING_O_NOFOLLOW 0 |
---|
124 | #define eaccess access |
---|
125 | #define HAVE_DECL_ALARM 1 |
---|
126 | #define _USE_STD_STAT 1 |
---|
127 | #define HAVE_DECL_FSEEKO 1 |
---|
128 | #define FUNC_FFLUSH_STDIN 0 |
---|
129 | #define restrict /**/ |
---|
130 | #define HAVE_DECL_FTELLO 1 |
---|
131 | #define HAVE_DECL_GETCWD 1 |
---|
132 | #define HAVE_DECL_GETDTABLESIZE 1 |
---|
133 | #define HAVE_GETOPT_H 1 |
---|
134 | #define HAVE_GETOPT_LONG_ONLY 1 |
---|
135 | #define HAVE_PTHREAD_API 1 |
---|
136 | #define SETLOCALE_NULL_ALL_MTSAFE 0 |
---|
137 | #define SETLOCALE_NULL_ONE_MTSAFE 1 |
---|
138 | #ifndef __powerpc__ |
---|
139 | #define __powerpc__ 1 |
---|
140 | #endif |
---|
141 | #ifndef __powerpc__ |
---|
142 | #define __powerpc__ 1 |
---|
143 | #endif |
---|
144 | #define HAVE_ICONV 1 |
---|
145 | #define ICONV_CONST const |
---|
146 | #define HAVE_WINT_T 1 |
---|
147 | #define HAVE_LONG_LONG_INT 1 |
---|
148 | #define HAVE_UNSIGNED_LONG_LONG_INT 1 |
---|
149 | #define BITSIZEOF_PTRDIFF_T 32 |
---|
150 | #define BITSIZEOF_SIZE_T 32 |
---|
151 | #define BITSIZEOF_SIG_ATOMIC_T 32 |
---|
152 | #define BITSIZEOF_WCHAR_T 32 |
---|
153 | #define BITSIZEOF_WINT_T 32 |
---|
154 | #define HAVE_SIGNED_SIG_ATOMIC_T 1 |
---|
155 | #define HAVE_SIGNED_WCHAR_T 1 |
---|
156 | #define HAVE_SIGNED_WINT_T 1 |
---|
157 | #define PTRDIFF_T_SUFFIX |
---|
158 | #define SIZE_T_SUFFIX ul |
---|
159 | #define SIG_ATOMIC_T_SUFFIX |
---|
160 | #define WCHAR_T_SUFFIX |
---|
161 | #define WINT_T_SUFFIX |
---|
162 | #define DBL_EXPBIT0_WORD 0 |
---|
163 | #define DBL_EXPBIT0_BIT 20 |
---|
164 | #define FLT_EXPBIT0_WORD 0 |
---|
165 | #define FLT_EXPBIT0_BIT 23 |
---|
166 | #define WORDS_BIGENDIAN 1 |
---|
167 | #define HAVE_TOWLOWER 1 |
---|
168 | #define HAVE_WCHAR_T 1 |
---|
169 | #define HAVE_LC_MESSAGES 1 |
---|
170 | #define HAVE_WORKING_USELOCALE 1 |
---|
171 | #define HAVE_GOOD_USELOCALE 1 |
---|
172 | #define HAVE_CFPREFERENCESCOPYAPPVALUE 1 |
---|
173 | #define MALLOC_0_IS_NONNULL 1 |
---|
174 | #define HAVE_MBSTATE_T 1 |
---|
175 | #define MAP_ANONYMOUS MAP_ANON |
---|
176 | #define HAVE_MAP_ANONYMOUS 1 |
---|
177 | #define HAVE_DECL_MEMRCHR 0 |
---|
178 | #define HAVE_MINMAX_IN_SYS_PARAM_H 1 |
---|
179 | #define PROMOTED_MODE_T int |
---|
180 | #define HAVE_DECL_POSIX_SPAWN 0 |
---|
181 | #define REPLACE_POSIX_SPAWN 1 |
---|
182 | #define HAVE_SIGSET_T 1 |
---|
183 | #define HAVE_SCHED_H 1 |
---|
184 | #define USER_LABEL_PREFIX _ |
---|
185 | #define HAVE_DECL_SNPRINTF 1 |
---|
186 | #define HAVE__BOOL 1 |
---|
187 | #define HAVE_DECL_FCLOSEALL 0 |
---|
188 | #define __USE_MINGW_ANSI_STDIO 1 |
---|
189 | #define HAVE_DECL_ECVT 1 |
---|
190 | #define HAVE_DECL_FCVT 1 |
---|
191 | #define HAVE_DECL_GCVT 1 |
---|
192 | #define HAVE_DECL_STRDUP 1 |
---|
193 | #define REPLACE_STRERROR_0 1 |
---|
194 | #define HAVE_DECL_STRNDUP 0 |
---|
195 | #define HAVE_DECL_STRNLEN 0 |
---|
196 | #define HAVE_DECL_STRSIGNAL 1 |
---|
197 | #define HAVE_DECL_EXECVPE 0 |
---|
198 | #define HAVE_DECL_CLEARERR_UNLOCKED 1 |
---|
199 | #define HAVE_DECL_FEOF_UNLOCKED 1 |
---|
200 | #define HAVE_DECL_FERROR_UNLOCKED 1 |
---|
201 | #define HAVE_DECL_FFLUSH_UNLOCKED 0 |
---|
202 | #define HAVE_DECL_FGETS_UNLOCKED 0 |
---|
203 | #define HAVE_DECL_FPUTC_UNLOCKED 0 |
---|
204 | #define HAVE_DECL_FPUTS_UNLOCKED 0 |
---|
205 | #define HAVE_DECL_FREAD_UNLOCKED 0 |
---|
206 | #define HAVE_DECL_FWRITE_UNLOCKED 0 |
---|
207 | #define HAVE_DECL_GETC_UNLOCKED 1 |
---|
208 | #define HAVE_DECL_GETCHAR_UNLOCKED 1 |
---|
209 | #define HAVE_DECL_PUTC_UNLOCKED 1 |
---|
210 | #define HAVE_DECL_PUTCHAR_UNLOCKED 1 |
---|
211 | #define HAVE_INTTYPES_H_WITH_UINTMAX 1 |
---|
212 | #define HAVE_STDINT_H_WITH_UINTMAX 1 |
---|
213 | #define HAVE_INTMAX_T 1 |
---|
214 | #define HAVE_SNPRINTF 1 |
---|
215 | #define HAVE_WCSLEN 1 |
---|
216 | #define HAVE_MBRTOWC 1 |
---|
217 | #define HAVE_WCRTOMB 1 |
---|
218 | #define HAVE_DECL__SNPRINTF 0 |
---|
219 | #define HAVE_SNPRINTF_RETVAL_C99 1 |
---|
220 | #define HAVE_SNPRINTF_TRUNCATION_C99 1 |
---|
221 | #define CHECK_PRINTF_SAFE 1 |
---|
222 | #define HAVE_DECL_WCSDUP 0 |
---|
223 | #define HAVE_SHUTDOWN 1 |
---|
224 | #define HAVE_STRUCT_SOCKADDR_STORAGE 1 |
---|
225 | #define HAVE_SA_FAMILY_T 1 |
---|
226 | #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 |
---|
227 | #define HAVE_IPV4 1 |
---|
228 | #define HAVE_IPV6 1 |
---|
229 | #define HAVE_PTHREAD_T 1 |
---|
230 | #define HAVE_DECL_SETENV 1 |
---|
231 | #define HAVE_SEARCH_H 1 |
---|
232 | #define HAVE_TSEARCH 1 |
---|
233 | #define HAVE_DECL_UNSETENV 1 |
---|
234 | #define GNULIB_TEST_ACCESS 1 |
---|
235 | #define HAVE_ALLOCA 1 |
---|
236 | #define GNULIB_TEST_BTOWC 1 |
---|
237 | #define HAVE___BUILTIN_EXPECT 1 |
---|
238 | #define GNULIB_TEST_CALLOC_POSIX 1 |
---|
239 | #define GNULIB_CANONICALIZE 1 |
---|
240 | #define GNULIB_TEST_CANONICALIZE 1 |
---|
241 | #define GNULIB_TEST_CANONICALIZE_FILE_NAME 1 |
---|
242 | #define GNULIB_CANONICALIZE_LGPL 1 |
---|
243 | #define GNULIB_TEST_CANONICALIZE_FILE_NAME 1 |
---|
244 | #define GNULIB_TEST_REALPATH 1 |
---|
245 | #define GNULIB_TEST_CHDIR 1 |
---|
246 | #define SIGNAL_SAFE_LIST 1 |
---|
247 | #define GNULIB_TEST_CLOEXEC 1 |
---|
248 | #define GNULIB_TEST_CLOSE 1 |
---|
249 | #define GNULIB_CLOSE_STREAM 1 |
---|
250 | #define HAVE_CLOSEDIR 1 |
---|
251 | #define GNULIB_TEST_CLOSEDIR 1 |
---|
252 | #define D_INO_IN_DIRENT 1 |
---|
253 | #define HAVE_DECL_DIRFD 1 |
---|
254 | #define GNULIB_TEST_DIRFD 1 |
---|
255 | #define GNULIB_DIRNAME 1 |
---|
256 | #define GNULIB_TEST_DUP 1 |
---|
257 | #define GNULIB_TEST_DUP2 1 |
---|
258 | #define GNULIB_TEST_ENVIRON 1 |
---|
259 | #define GNULIB_TEST_FCHDIR 1 |
---|
260 | #define FUNC_FFLUSH_STDIN 0 |
---|
261 | #define GNULIB_TEST_FCLOSE 1 |
---|
262 | #define GNULIB_TEST_FCNTL 1 |
---|
263 | #define GNULIB_FD_SAFER_FLAG 1 |
---|
264 | #define HAVE_DECL_FDOPENDIR 0 |
---|
265 | #define GNULIB_TEST_FDOPENDIR 1 |
---|
266 | #define GNULIB_FDOPENDIR 1 |
---|
267 | #define FUNC_FFLUSH_STDIN 0 |
---|
268 | #define GNULIB_FFLUSH 1 |
---|
269 | #define GNULIB_TEST_FFLUSH 1 |
---|
270 | #define GNULIB_FILENAMECAT 1 |
---|
271 | #define FLEXIBLE_ARRAY_MEMBER /**/ |
---|
272 | #define GNULIB_TEST_FOPEN 1 |
---|
273 | #define GNULIB_FOPEN_GNU 1 |
---|
274 | #define GNULIB_FOPEN_SAFER 1 |
---|
275 | #define HAVE_DECL_FPURGE 1 |
---|
276 | #define GNULIB_TEST_FPURGE 1 |
---|
277 | #define GNULIB_TEST_FREE_POSIX 1 |
---|
278 | #define HAVE_FREXP_IN_LIBC 1 |
---|
279 | #define GNULIB_TEST_FREXP 1 |
---|
280 | #define GNULIB_TEST_FREXPL 1 |
---|
281 | #define GNULIB_TEST_FSEEK 1 |
---|
282 | #define FUNC_FFLUSH_STDIN 0 |
---|
283 | #define GNULIB_TEST_FSEEKO 1 |
---|
284 | #define GNULIB_TEST_FSTAT 1 |
---|
285 | #define GNULIB_TEST_FSTATAT 1 |
---|
286 | #define GNULIB_TEST_FTELL 1 |
---|
287 | #define GNULIB_TEST_FTELLO 1 |
---|
288 | #define HAVE_GETPAGESIZE 1 |
---|
289 | /* end confdefs.h. */ |
---|
290 | |
---|
291 | #include <errno.h> |
---|
292 | #include <stdlib.h> |
---|
293 | #if HAVE_UNISTD_H |
---|
294 | # include <unistd.h> |
---|
295 | #else /* on Windows with MSVC */ |
---|
296 | # include <direct.h> |
---|
297 | #endif |
---|
298 | #include <string.h> |
---|
299 | #include <sys/stat.h> |
---|
300 | |
---|
301 | |
---|
302 | /* Arrange to define PATH_MAX, like "pathmax.h" does. */ |
---|
303 | #if HAVE_UNISTD_H |
---|
304 | # include <unistd.h> |
---|
305 | #endif |
---|
306 | #include <limits.h> |
---|
307 | #if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN |
---|
308 | # include <sys/param.h> |
---|
309 | #endif |
---|
310 | #if !defined PATH_MAX && defined MAXPATHLEN |
---|
311 | # define PATH_MAX MAXPATHLEN |
---|
312 | #endif |
---|
313 | #ifdef __hpux |
---|
314 | # undef PATH_MAX |
---|
315 | # define PATH_MAX 1024 |
---|
316 | #endif |
---|
317 | #if defined _WIN32 && ! defined __CYGWIN__ |
---|
318 | # undef PATH_MAX |
---|
319 | # define PATH_MAX 260 |
---|
320 | #endif |
---|
321 | |
---|
322 | |
---|
323 | |
---|
324 | |
---|
325 | #if defined _WIN32 && !defined __CYGWIN__ |
---|
326 | #define access _access |
---|
327 | #define chdir _chdir |
---|
328 | #define chmod _chmod |
---|
329 | #define close _close |
---|
330 | #define creat _creat |
---|
331 | #define dup _dup |
---|
332 | #define dup2 _dup2 |
---|
333 | #define ecvt _ecvt |
---|
334 | #define execl _execl |
---|
335 | #define execle _execle |
---|
336 | #define execlp _execlp |
---|
337 | #define execv _execv |
---|
338 | #define execve _execve |
---|
339 | #define execvp _execvp |
---|
340 | #define execvpe _execvpe |
---|
341 | #define fcloseall _fcloseall |
---|
342 | #define fcvt _fcvt |
---|
343 | #define fdopen _fdopen |
---|
344 | #define fileno _fileno |
---|
345 | #define gcvt _gcvt |
---|
346 | #define getcwd _getcwd |
---|
347 | #define getpid _getpid |
---|
348 | #define getw _getw |
---|
349 | #define isatty _isatty |
---|
350 | #define j0 _j0 |
---|
351 | #define j1 _j1 |
---|
352 | #define jn _jn |
---|
353 | #define lfind _lfind |
---|
354 | #define lsearch _lsearch |
---|
355 | #define lseek _lseek |
---|
356 | #define memccpy _memccpy |
---|
357 | #define mkdir _mkdir |
---|
358 | #define mktemp _mktemp |
---|
359 | #define open _open |
---|
360 | #define putenv _putenv |
---|
361 | #define putw _putw |
---|
362 | #define read _read |
---|
363 | #define rmdir _rmdir |
---|
364 | #define strdup _strdup |
---|
365 | #define swab _swab |
---|
366 | #define tempnam _tempnam |
---|
367 | #define tzset _tzset |
---|
368 | #define umask _umask |
---|
369 | #define unlink _unlink |
---|
370 | #define utime _utime |
---|
371 | #define wcsdup _wcsdup |
---|
372 | #define write _write |
---|
373 | #define y0 _y0 |
---|
374 | #define y1 _y1 |
---|
375 | #define yn _yn |
---|
376 | #endif |
---|
377 | |
---|
378 | |
---|
379 | |
---|
380 | #ifndef S_IRWXU |
---|
381 | # define S_IRWXU 0700 |
---|
382 | #endif |
---|
383 | |
---|
384 | /* FIXME: skip the run-test altogether on systems without getpagesize. */ |
---|
385 | #if ! HAVE_GETPAGESIZE |
---|
386 | # define getpagesize() 0 |
---|
387 | #endif |
---|
388 | |
---|
389 | /* This size is chosen to be larger than PATH_MAX (4k), yet smaller than |
---|
390 | the 16kB pagesize on ia64 linux. Those conditions make the code below |
---|
391 | trigger a bug in glibc's getcwd implementation before 2.4.90-10. */ |
---|
392 | #define TARGET_LEN (5 * 1024) |
---|
393 | |
---|
394 | int |
---|
395 | main () |
---|
396 | { |
---|
397 | char *cwd; |
---|
398 | size_t initial_cwd_len; |
---|
399 | int fail = 0; |
---|
400 | |
---|
401 | /* The bug is triggered when PATH_MAX < getpagesize (), so skip |
---|
402 | this relatively expensive and invasive test if that's not true. */ |
---|
403 | #ifdef PATH_MAX |
---|
404 | int bug_possible = PATH_MAX < getpagesize (); |
---|
405 | #else |
---|
406 | int bug_possible = 0; |
---|
407 | #endif |
---|
408 | if (! bug_possible) |
---|
409 | return 0; |
---|
410 | |
---|
411 | cwd = getcwd (NULL, 0); |
---|
412 | if (cwd == NULL) |
---|
413 | return 2; |
---|
414 | |
---|
415 | initial_cwd_len = strlen (cwd); |
---|
416 | free (cwd); |
---|
417 | |
---|
418 | if (1) |
---|
419 | { |
---|
420 | static char const dir_name[] = "confdir-14B---"; |
---|
421 | size_t desired_depth = ((TARGET_LEN - 1 - initial_cwd_len) |
---|
422 | / sizeof dir_name); |
---|
423 | size_t d; |
---|
424 | for (d = 0; d < desired_depth; d++) |
---|
425 | { |
---|
426 | if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0) |
---|
427 | { |
---|
428 | if (! (errno == ERANGE || errno == ENAMETOOLONG |
---|
429 | || errno == ENOENT)) |
---|
430 | fail = 3; /* Unable to construct deep hierarchy. */ |
---|
431 | break; |
---|
432 | } |
---|
433 | } |
---|
434 | |
---|
435 | /* If libc has the bug in question, this invocation of getcwd |
---|
436 | results in a failed assertion. */ |
---|
437 | cwd = getcwd (NULL, 0); |
---|
438 | if (cwd == NULL) |
---|
439 | fail = 4; /* getcwd didn't assert, but it failed for a long name |
---|
440 | where the answer could have been learned. */ |
---|
441 | free (cwd); |
---|
442 | |
---|
443 | /* Call rmdir first, in case the above chdir failed. */ |
---|
444 | rmdir (dir_name); |
---|
445 | while (0 < d--) |
---|
446 | { |
---|
447 | if (chdir ("..") < 0) |
---|
448 | { |
---|
449 | fail = 5; |
---|
450 | break; |
---|
451 | } |
---|
452 | rmdir (dir_name); |
---|
453 | } |
---|
454 | } |
---|
455 | |
---|
456 | return fail; |
---|
457 | } |
---|
458 | |
---|