summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/fts.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Bump fts_level from short to int and add a spare short so thingsmillert2010-09-241-2/+2
| | | | line up nicely. OK deraadt@
* Don't stop traversing a directory hierarchy if we reach SHRT_MAX,millert2009-08-271-10/+8
| | | | | | | | just stop updating fts_level so we don't overflow it. This allows rm, find, etc to operate on very deep hierarchies. Consumers of fts(3) do need to be aware that the actual level may be larger than fts_level. During the next libc major bump we will make fts_level an int instead of a short. OK deraadt@
* Avoid level going negative on deep (i mean really deep) dirs. Reportedotto2009-02-111-1/+9
| | | | by Maksymilian Arciemowicz. ok kettenis@ millert@
* Fix file descriptor leak in fts_children(); okay dhill@, millert@,pedro2008-12-271-2/+4
| | | | tedu@, thib@.
* malloc/memset -> callocchl2007-11-061-3/+2
| | | | ok ray@
* Simplify some of the logic in fts_close(). Initially based on amillert2007-11-021-17/+14
| | | | diff from chl@. OK otto@ and chl@.
* fix mem leak, from NetBSD; ok miod@ kettenis@otto2007-01-081-1/+4
|
* zap remaining rcsid.espie2005-08-081-9/+1
| | | | | | Kill old files that are no longer compiled. okay theo
* bye bye whiteoutsmillert2005-06-171-18/+2
|
* bye bye whiteoutsmillert2005-06-161-12/+4
|
* ansification; checked by pvalderaadt2003-06-111-50/+18
|
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-7/+3
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* Add a missing check for fts_alloc() returning NULL; Chad Lodermillert2002-07-121-3/+4
|
* %uderaadt2002-06-271-3/+3
|
* Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.millert2002-02-161-13/+13
|
* Zero out entire FTS after allocating it instead of just zeroing outmillert2001-08-271-14/+9
| | | | a few fields by hand; Closes PR 2033
* Update sp->fts_cur in fts_read() before returning NULL. Thismillert2001-08-031-2/+5
| | | | | prevents a duplicate free() in fts_close(). From karls@inet.no with some other, similar cases added.
* Fix another case of CHDIR("..") pointed out by Bruce Evansmillert2001-05-311-22/+14
| | | | | | <bde@zeta.org.au>. Instead of fixing these inline I've modified my fts_safe_changedir() function so it can be used in this case too. Thanks also to Kris Kennaway <kris@obsecurity.org>.
* When changing directory to '..', verify that we really are wheremillert2001-05-301-4/+11
| | | | | | | we should be. This is similar to the old fts bug but happens when popping out of directories, as opposed to descending into them. Patch based on one by Kris Kennaway <kris@obsecurity.org>. Issue reported by Nick Cleaton <nick@cleaton.net>
* Make path length variables size_t. This fixes the problem wheremillert2001-05-151-68/+52
| | | | | | | | | things like rm can't remove files with ridiculously long path names that were created by some script kiddie trying in vain to exploit something. Previously, the length was effectively constrained to USHRT_MAX due to one of the internal structs. Also, nuke FTS_CHDIRROOT since it never worked correctly and hasn't been documented for a long time.
* KNFderaadt2000-08-241-3/+3
|
* put back FTS_CHDIRROOT until next library major number crankmillert1999-10-031-8/+22
|
* kill FTS_CHDIRROOT flag, it is broken beyond repair and no longer usedmillert1999-10-031-22/+8
|
* Fix multiple problems in the FTS_NOCHDIR case (mycroft@netbsd.org):millert1999-10-031-22/+47
| | | | | | | | | | | | | | | | | | * There was an off-by-one error that caused the addition of a NUL or slash in fts_build() to overwrite other memory. * After fts_palloc(), we need to reset `cp' so that it points to the new path name buffer; otherwise the addition of the file name before calling fts_stat() could lose. Also, fix stupidity in the fts_palloc() interface. We don't want N bytes more than the current buffer size; we want N bytes more than the current length. Just pass in the new size, since we can't figure it out easily here. fts_padjust() was doing more work than it needed to. Based on changes from mycroft@netbsd.org. Check for fts_pathlen oflow in two places. Done before I saw the NetBSD change (and last I checked they only did one of the checks). In the case of wrap, return ENAMETOOLONG.
* If the FTS_NOCHDIR flag is set and the final directory is empty,millert1999-08-161-3/+3
| | | | the trailing '/' would not be chopped; pho@freebsd.org
* 1) Only do pointer adjusting if realloc() changed our pointermillert1999-05-171-17/+29
| | | | | | | 2) Only adjust pointers based on ftp_path, not fts_name. 3) Adjust the entries in the file list, as well as the trees, if needed. Loosely based on a patch from Stas Kisel <stas@SONET.CRIMEA.UA>
* fix realloc patchderaadt1998-08-151-4/+4
|
* realloc repairderaadt1998-08-141-5/+20
|
* do not free() before last ref; kmayer@freegate.comderaadt1998-07-031-5/+7
|
* some -Wallmillert1998-03-191-6/+8
|
* Replace my trailing slash removal with the one from FreeBSD.millert1997-10-111-11/+3
|
* Fix bug caused by trailing '/' stripping. Didn't always guarantee NULLmillert1997-10-061-4/+5
| | | | termination. Now we do.
* Strip trailing '/' from paths. Noted by hermit@cs.tu-berlin.de inmillert1997-09-201-2/+10
| | | | | the form of an ls(1) bug and dm@reeducation-labor.lcs.mit.edu in the form of a cp(1) bug.
* Fix problem with ``find -execdir'' not having the correct initial cwd.millert1997-09-011-11/+25
| | | | Adds a new flag to fts(3).
* Minor KNF changes to fts_safe_chdir and recent NetBSD code integrationimp1997-08-291-14/+8
| | | | as pointed out by Bruce Evans.
* From NetBSD (phil):millert1997-08-021-7/+7
| | | | | | - Add args for compar() function decl. - Fix it so fts_* never adds a / to a path name when there is already a trailing /. Fixes NetBSD PR 1495.
* trailing blankskstailey1997-07-231-7/+7
|
* Make sure head, tail, and nitems get zero'd even if wemillert1997-03-241-78/+83
| | | | | can't cd to the target dir. Fixes rogue pointer problem introduced with safe chdir changes.
* Final fix to make fts(3) spoof-proof.millert1997-01-171-72/+76
|
* Be extra careful when chdir'ing to subdirs.millert1997-01-141-5/+49
|
* Back out last change, it is not sufficient.millert1996-12-231-25/+7
|
* Avoid spoofing when cd'ing to subdirs. First cut.millert1996-12-231-7/+25
|
* Fix RCS idstholo1996-08-191-7/+1
| | | | Make sure everything uses {SYS,}LIBC_SCCS properly
* initial import of NetBSD treederaadt1995-10-181-0/+1006