Home | History | Annotate | Download | only in gen
History log of /src/lib/libc/gen/fts.c
RevisionDateAuthorComments
 1.52  19-Apr-2022  rillig lib: remove CONSTCOND comment

Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
 1.51  12-Mar-2022  christos reallocarr returns errno. preserve it.
 1.50  02-Nov-2021  nia fts(3): Use reallocarr instead of realloc(x * y), eliminate a temporary
variable.
 1.49  31-May-2016  pgoyette Use calloc(1, ...) instead of malloc(...) followed immediately by memset()

Addresses PR lib/46818
 1.48  29-Jan-2015  manu Fix double free in fts_read()/fts_close()

When fts_read() gets an error on fchdir(), it exited with sp->fts_cur
set to a freed structure. fts_close() would later attempt to free it
again, crashing the program.
 1.47  18-Sep-2014  christos make more descriptors that we open as close-on-exec
 1.46  26-Sep-2012  msaitoh Fix in comment.
 1.45  15-Sep-2012  spz remove dubious cast
 1.44  14-Mar-2012  christos branches: 1.44.2;
rename the macros ftsent_ since they apply to the ftsent struct not the
fts one.
 1.43  13-Mar-2012  christos PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@
 1.42  16-Oct-2011  mrg branches: 1.42.2;
default O_CLOEXEC to 0 for systems that don't define it, like, say, netbsd-5.
 1.41  15-Oct-2011  christos close on exec fixes:
- open + fcntl -> open O_CLOEXEC
- configuration database file descriptors that can stay open are now opened
fopen(db, "re")
 1.40  02-Nov-2009  stacktic Make sure fts_statp is NULL when FTS_NOSTAT is set
 1.39  16-Aug-2009  christos Version fts one more time! This is the most versioned API ever... Bump
fts_level from short to int to avoid a potential DoS.
From Maksymilian Arciemowicz
 1.38  28-Feb-2009  pgoyette Avoid possible integer overflow and subsequent collateral damage.
Received from OpenBSD via US-CERT as VU #590371.

Original OpenBSD commit log:

> revision 1.42
> date: 2009/02/11 13:24:05; author: otto; state: Exp; lines: +9 -1
> Avoid level going negative on deep (i mean really deep) dirs. Reported
> by Maksymilian Arciemowicz. ok kettenis@ millert@
 1.37  03-Feb-2009  lukem branches: 1.37.2;
fix sign-compare issue
 1.36  11-Jan-2009  christos merge christos-time_t
 1.35  03-Jan-2009  lukem Ensure fts_close() doesn't spuriously close fd 0,
by testing FTS_SYMFOLLOW in fts_flags instead of fts_options.
Fix provided by Ben Harris in PR 40319
 1.34  27-Sep-2008  lukem branches: 1.34.4; 1.34.6;
fix unused variable if !defined(FTS_ALLOC_ALIGNED)
 1.33  20-Sep-2008  lukem Add fts_free() to complement fts_alloc(), and use instead of free().
Should avoid a memory leak on systems without ALIGNBYTES.
 1.32  10-Mar-2008  lukem Style tweaks:
* test defined(HAVE_foo) not just HAVE_foo
* replace u_foo with unsigned foo
* the whitespace change whose name we dare not mention
 1.31  30-Mar-2006  christos branches: 1.31.4; 1.31.10; 1.31.14; 1.31.16;
PR/33163: Auster Vl.: fts: cant allocate memory | filename too long
Change the ftp_pathlen and fts_namelen to u_int from u_short so that
pathnames > 32K work.
 1.30  19-Mar-2006  christos Coverity CID 17: Free parent if it was not used.
 1.29  11-Dec-2005  christos Restore the compatibility versions of fts not to do path mangling (i.e.
remove double slashes). Also make sure we free sp in all cases. From yamt,
many thanks!
 1.28  18-Nov-2005  christos ANSI prototypes and function declarations. No functional change.
 1.27  17-Nov-2005  christos 1. minimize code diffs with FreeBSD
2. return ENAMETOOLONG instead of ENOMEM if name is too long to fit.
3. only decrement cp if we are pointing to the end of the string.
[this fixes the cp truncation of the last char problem reported]
 1.26  22-Oct-2005  christos Instead of special-casing root, special case paths that end with a /, so
that find foo/ does not print foo//bar. From FreeBSD.
 1.25  13-Sep-2005  christos compat core reorg.
 1.24  19-Aug-2005  christos 64 bit inode changes
 1.23  04-Dec-2003  keihan netbsd.org -> NetBSD.org
NetBSD.ORG -> NetBSD.org

Now src/lib is done.
 1.22  22-Oct-1997  thorpej Allow the old-name functions to be compiled from the same source file as
the renamed functions, and add some #error directives to force the
issue with weak symbols for renamed functions when we support weak
symbols in the C library.
 1.21  22-Oct-1997  fvdl New hacks to make libc work painlessly without bumping the major number:
use type func(arg1s) asm("emitted_name") gcc mechanism.
Suggested by Bill Sommerfeld.
 1.20  21-Oct-1997  fvdl branches: 1.20.2;
Hacks to enable libc to work without bumping the major.
 1.19  09-Oct-1997  christos Revert all slash removing changes; it is not worth it...
The latest one broke "ls foo.c/". Sync with Lite-2.
 1.18  08-Oct-1997  pk Restore the NAPPEND macro, as it existed until revision 1.13, that deals
with roots consisting of a single slash. This special case of special
cases cannot be dealt with in fts_open() by simply chopping of a
trailing slash.

All this to avoid the occasional doubling of slashes. Oh well..
 1.17  07-Oct-1997  pk In fts_alloc() copy the trailing 0 character explicitly, instead of
relying on the passed input string having a 0 character at the right spot.
Takes care of PR#4234.
 1.16  27-Sep-1997  pk The change in revision 1.13 to avoid doubling slashes in path names
messes up the internal administrations of the fts engine.

Do this differently by simply stripping one trailing slash (if any)
from root paths passed to fts_open().
 1.15  21-Jul-1997  jtc If port provides __weak_alias(), provide an Standard C and POSIX pure
identifier namespace by renaming non standard functions and variables
such that they have a leading underscore. The library will use those
names internally. Weak aliases are used to provide the original names
to the API.

This is only the first part of this change. It is most of the functions
which are implemented in C for all NetBSD ports. Subsequent changes are
to add the same support to the remaining C files, to assembly files, and
to the automagically generated assembly source used for system calls.
When all of the above is done, ports with weak alias support should add
a definition for __weak_alias to <sys/cdefs.h>.
 1.14  13-Jul-1997  christos Fix RCSID's
Add missing prototypes.
Fix rest of gcc warnings.
 1.13  10-Jul-1997  phil Fix it so fts_* never adds a / to a path name when there is
already a trailing /. Fixes PR 1495.
 1.12  27-Feb-1995  cgd branches: 1.12.4;
merge with Lite, keeping local changes. Also use new Id format.
 1.11  28-Dec-1994  mycroft branches: 1.11.2;
Mostly sync with CSRG.
 1.10  26-Oct-1994  mycroft Avoid extra stat()s if a link count of 1 is returned for directories but the
d_type field is filled in.
 1.9  17-Apr-1994  cgd POSIXification and bostic's official fix for the missing relative path problem
 1.8  12-Apr-1994  cgd re-POSIXIFICATION. should have been punted back to bostic...
 1.7  12-Apr-1994  cgd oops, restore bug fix that wasn't fed back to bostic...
 1.6  12-Apr-1994  cgd minor fixes
 1.5  14-Jan-1994  jtc Fix obscure bug where the working directory would not be restored to its
proper place (occurs if one of fts_open()'s arguments is a relative path
to a empty directory).
 1.4  24-Nov-1993  jtc Change C library functions to use strchr() and strrchr() instead of index()
and rindex(). This will allow (strict {ANSI, POSIX, XOPEN}) applications
to redefine index() and rindex() without effecting the library internals.
 1.3  26-Aug-1993  jtc Declare rcsid strings so they are stored in text segment.
 1.2  30-Jul-1993  mycroft Latest versions from uunet.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3  02-Feb-1998  perry import lite-2
 1.1.1.2  25-Feb-1995  cgd from lite, with minor name rearrangement to fit.
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.11.2.1  02-May-1995  jtc #include "namespace.h"
 1.12.4.2  16-Sep-1996  jtc snapshot namespace cleanup: rpc & xdr
 1.12.4.1  16-Sep-1996  jtc snapshot namespace cleanup
 1.20.2.2  22-Oct-1997  thorpej Pull up from trunk:

New hacks to make libc work painlessly without bumping the major number:
use type func(arg1s) asm("emitted_name") gcc mechanism.
Suggested by Bill Sommerfeld.

Allow the old-name functions to be compiled from the same source file as
the renamed functions, and add some #error directives to force the
issue with weak symbols for renamed functions when we support weak
symbols in the C library.
 1.20.2.1  21-Oct-1997  thorpej file fts.c was added on branch netbsd-1-3 on 1997-10-22 06:41:30 +0000
 1.31.16.1  24-Mar-2008  keiichi sync with head.
 1.31.14.1  15-Jan-2009  bouyer Pull up following revision(s) (requested by lukem in ticket #1256):
lib/libc/gen/fts.c: revision 1.35
Ensure fts_close() doesn't spuriously close fd 0,
by testing FTS_SYMFOLLOW in fts_flags instead of fts_options.
Fix provided by Ben Harris in PR 40319
 1.31.10.1  23-Mar-2008  matt sync with HEAD
 1.31.4.1  15-Jan-2009  bouyer Pull up following revision(s) (requested by lukem in ticket #1256):
lib/libc/gen/fts.c: revision 1.35
Ensure fts_close() doesn't spuriously close fd 0,
by testing FTS_SYMFOLLOW in fts_flags instead of fts_options.
Fix provided by Ben Harris in PR 40319
 1.34.6.2  04-Jan-2009  christos merge with head.
 1.34.6.1  27-Sep-2008  christos file fts.c was added on branch christos-time_t on 2009-01-04 17:02:19 +0000
 1.34.4.2  16-Aug-2009  bouyer Pull up following revision(s) (requested by christos in ticket #915):
lib/libc/gen/fts.c: revision 1.38
Avoid possible integer overflow and subsequent collateral damage.
Received from OpenBSD via US-CERT as VU #590371.
Original OpenBSD commit log:
revision 1.42
date: 2009/02/11 13:24:05; author: otto; state: Exp; lines: +9 -1
Avoid level going negative on deep (i mean really deep) dirs. Reported
by Maksymilian Arciemowicz. ok kettenis@ millert@
 1.34.4.1  08-Jan-2009  snj branches: 1.34.4.1.2; 1.34.4.1.4;
Pull up following revision(s) (requested by lukem in ticket #226):
lib/libc/gen/fts.c: revision 1.35
Ensure fts_close() doesn't spuriously close fd 0,
by testing FTS_SYMFOLLOW in fts_flags instead of fts_options.
Fix provided by Ben Harris in PR 40319
 1.34.4.1.4.1  21-Apr-2010  matt sync to netbsd-5
 1.34.4.1.2.1  16-Aug-2009  bouyer Pull up following revision(s) (requested by christos in ticket #915):
lib/libc/gen/fts.c: revision 1.38
Avoid possible integer overflow and subsequent collateral damage.
Received from OpenBSD via US-CERT as VU #590371.
Original OpenBSD commit log:
revision 1.42
date: 2009/02/11 13:24:05; author: otto; state: Exp; lines: +9 -1
Avoid level going negative on deep (i mean really deep) dirs. Reported
by Maksymilian Arciemowicz. ok kettenis@ millert@
 1.37.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.42.2.2  30-Oct-2012  yamt sync with head
 1.42.2.1  17-Apr-2012  yamt sync with head
 1.44.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC

RSS XML Feed