summaryrefslogtreecommitdiff
path: root/lib/savedir.c
AgeCommit message (Collapse)Author
2001-08-31(savedir): Remove size parameter, as POSIX says thatJim Meyering
a directory's st_size can have an arbitrary value, so the old usage could waste an arbitrary amount of memory. All uses changed.
2000-06-27savedir now sets errno on failure and invokes xmalloc to get memory.Jim Meyering
Fix a couple of other minor bugs while we're at it. (<unistd.h>): Do not include; there's no need. (NAMLEN): Remove macro. (malloc, realloc): Remove decls. (stpcpy): Likewise. ("xalloc.h"): Include. (NAME_SIZE_DEFAULT): New macro. (savedir): Use xmalloc / xrealloc to allocate memory. Use NAME_SIZE_DEFAULT if name_size is negative or overflows to zero. Skip "" directory entries. Use strlen to calculate directory entry length, since the old method is rarely used these days and isn't worth supporting. Don't use a pointer after freeing it. Check for integer overflow when calculating allocation size. Use memcpy to copy entries, instead of stpcpy. Set errno properly when returning NULL. Check for readdir error.
2000-03-08(savedir): Work even if directory size isJim Meyering
negative; this can happen with some screwy NFS configurations.
2000-01-04(savedir): Don't store past the end of an array ifJim Meyering
name_size is zero and the directory is empty.
1999-08-08fix typoJim Meyering
1999-08-08(savedir): Change type of name_size parameter to off_t.Jim Meyering
1998-12-07ansideclifyJim Meyering
1998-03-15Use #if, not #ifdef with HAVE_ macrosJim Meyering
1997-12-25Declare stpcpy only if not defined as macro.Jim Meyering
1997-11-30(savedir): Revert last change. malloc alwaysJim Meyering
works when called with zero, because we use the wrapper if the system version is lacking.
1997-11-30(savedir): Check for size zero before invokingJim Meyering
malloc; this can occur if st_size arg overflows on conversion to unsigned int. All callers now cast st_size arg to unsigned int.
1997-10-24Use unsigned int, not just unsigned.Jim Meyering
1997-10-04(savedir): Declare DIR parameter to be const.Jim Meyering
Include savedir.h.
1996-07-15update FSF address in copyrightJim Meyering
1994-10-20merge with 3.9pJim Meyering
1994-10-17.Jim Meyering
1994-10-02merge with 3.9hJim Meyering
1994-10-02.Jim Meyering
1994-07-30.Jim Meyering
1992-10-31Initial revisionJim Meyering