Changeset 809 for trunk/src/gmake/kmkbuiltin/fts.c
- Timestamp:
- Jan 29, 2007, 6:54:36 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmake/kmkbuiltin/fts.c
r621 r809 56 56 #include <stdlib.h> 57 57 #include <string.h> 58 #ifndef _MSC_VER59 58 #include <unistd.h> 60 #else 61 #include "mscfakes.h" 62 #define dirfd(dir) -1 63 #endif 64 #include "ftsfake.h" 59 60 #ifdef __sun__ 61 # include "solfakes.h" 62 # define dirfd(dir) -1 63 #endif 64 #ifdef _MSC_VER 65 # include "mscfakes.h" 66 # define dirfd(dir) -1 67 #endif 65 68 66 69 #if ! HAVE_NBTOOL_CONFIG_H 70 #ifndef __sun__ 67 71 #define HAVE_STRUCT_DIRENT_D_NAMLEN 1 72 #endif 68 73 #endif 69 74 … … 78 83 #endif /* __LIBC12_SOURCE__ */ 79 84 #endif /* __weak_alias */ 80 #endif 85 #endif 81 86 82 87 #ifdef __LIBC12_SOURCE__ … … 120 125 #undef HAVE_STRUCT_DIRENT_D_NAMLEN 121 126 #undef HAVE_FCHDIR 122 #endif 127 #endif 123 128 124 129 #if defined(__EMX__) || defined(_MSC_VER) … … 268 273 if ((sp->fts_rdir = getcwd(NULL, 0)) != NULL) 269 274 SET(FTS_NOCHDIR); 270 #endif 275 #endif 271 276 } 272 277 … … 374 379 if (chdir(sp->fts_rdir)) 375 380 saved_errno = errno; 376 free(sp->fts_rdir); 381 free(sp->fts_rdir); 377 382 sp->fts_rdir = NULL; 378 #endif 383 #endif 379 384 } 380 385 … … 467 472 p->fts_info = FTS_DP; 468 473 return (p); 469 } 474 } 470 475 471 476 /* Rebuild if only read the names and now traversing. */ … … 520 525 #else 521 526 if (CHDIR(sp, sp->fts_rdir)) { 522 #endif 527 #endif 523 528 SET(FTS_STOP); 524 529 return (NULL); … … 587 592 #else 588 593 if (CHDIR(sp, sp->fts_rdir)) { 589 #endif 594 #endif 590 595 SET(FTS_STOP); 591 596 return (NULL); … … 691 696 SET(FTS_NAMEONLY); 692 697 instr = BNAMES; 693 } else 698 } else 694 699 instr = BCHILD; 695 700 … … 913 918 } else if (nlinks == 0 914 919 #ifdef DT_DIR 915 || (nostat && 920 || (nostat && 916 921 dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN) 917 922 #endif … … 979 984 #else 980 985 CHDIR(sp, sp->fts_rdir) : 981 #endif 986 #endif 982 987 fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) { 983 988 cur->fts_info = FTS_ERR; … … 1039 1044 errno = 0; 1040 1045 return (FTS_SLNONE); 1041 } 1046 } 1042 1047 p->fts_errno = saved_errno; 1043 1048 goto err; … … 1114 1119 for (ap = sp->fts_array, p = head; p; p = p->fts_link) 1115 1120 *ap++ = p; 1116 qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), 1121 qsort((void *)sp->fts_array, nitems, sizeof(FTSENT *), 1117 1122 (int (*)(const void *, const void *))sp->fts_compar); 1118 1123 for (head = *(ap = sp->fts_array); --nitems; ++ap) … … 1222 1227 * Most systems will allow creation of paths much longer than MAXPATHLEN, even 1223 1228 * though the kernel won't resolve them. Round up the new size to a power of 2, 1224 * so we don't realloc the path 2 bytes at a time. 1229 * so we don't realloc the path 2 bytes at a time. 1225 1230 */ 1226 1231 static int
Note:
See TracChangeset
for help on using the changeset viewer.