Changeset 2990 in kBuild
- Timestamp:
- Nov 1, 2016 9:55:39 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/nt/fts-nt.c
r2989 r2990 176 176 the API user code happy. 1. Lone drive letters get a dot 177 177 appended so it won't matter if a slash is appended afterwards. 178 178 2. DOS slashes are converted to UNIX ones. */ 179 179 char *slash; 180 180 len = strlen(*argv); … … 261 261 len = p->fts_pathlen = p->fts_namelen; 262 262 memmove(sp->fts_path, p->fts_name, len + 1); 263 /** @todo check for ':' and '\\'? */264 263 if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) { 265 264 len = strlen(++cp); … … 510 509 } 511 510 512 #if 0513 511 FTSENT * FTSCALL 514 512 fts_children(FTS *sp, int instr) 515 513 { 516 514 FTSENT *p; 517 int fd, rc, serrno;518 515 519 516 if (instr != 0 && instr != FTS_NAMEONLY) { … … 548 545 549 546 /* Free up any previous child list. */ 550 if (sp->fts_child != NULL) 547 if (sp->fts_child != NULL) { 551 548 fts_lfree(sp->fts_child); 552 549 sp->fts_child = NULL; /* (bird - double free for _open(".") failure in original) */ 550 } 551 552 /* NT: Some BSD utility sets FTS_NAMEONLY? We don't really need this 553 optimization, but since it only hurts that utility, it can stay. */ 553 554 if (instr == FTS_NAMEONLY) { 555 assert(0); /* don't specify FTS_NAMEONLY on NT. */ 554 556 SET(FTS_NAMEONLY); 555 557 instr = BNAMES; … … 557 559 instr = BCHILD; 558 560 559 /* 560 * If using chdir on a relative path and called BEFORE fts_read does 561 * its chdir to the root of a traversal, we can lose -- we need to 562 * chdir into the subdirectory, and we don't know where the current 563 * directory is, so we can't get back so that the upcoming chdir by 564 * fts_read will work. 565 */ 566 if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' || 567 ISSET(FTS_NOCHDIR)) 568 return (sp->fts_child = fts_build(sp, instr)); 569 570 if ((fd = _open(".", O_RDONLY | O_CLOEXEC, 0)) < 0) 571 return (NULL); 572 sp->fts_child = fts_build(sp, instr); 573 serrno = (sp->fts_child == NULL) ? errno : 0; 574 rc = fchdir(fd); 575 if (rc < 0 && serrno == 0) 576 serrno = errno; 577 (void)_close(fd); 578 errno = serrno; 579 if (rc < 0) 580 return (NULL); 581 return (sp->fts_child); 582 } 583 #endif /* PORTME */ 561 return (sp->fts_child = fts_build(sp, instr)); 562 } 584 563 585 564 #ifndef fts_get_clientptr
Note:
See TracChangeset
for help on using the changeset viewer.