lib/savedir.c


Log

Author Commit Date CI Message
Jim Meyering 21d2d10d 2001-08-31T09:09:53 (savedir): Remove size parameter, as POSIX says that a directory's st_size can have an arbitrary value, so the old usage could waste an arbitrary amount of memory. All uses changed.
Jim Meyering 49c86fdb 2000-06-27T07:08:48 savedir now sets errno on failure and invokes xmalloc to get memory. 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.
Jim Meyering 30f76aad 2000-03-08T14:50:05 (savedir): Work even if directory size is negative; this can happen with some screwy NFS configurations.
Jim Meyering 7df90f6a 2000-01-04T22:54:54 (savedir): Don't store past the end of an array if name_size is zero and the directory is empty.
Jim Meyering 14e721e5 1999-08-08T10:16:53 fix typo
Jim Meyering 8e2cc070 1999-08-08T10:12:43 (savedir): Change type of name_size parameter to off_t.
Jim Meyering cf42d3e5 1998-12-07T03:12:10 ansideclify
Jim Meyering 67f394c1 1998-03-15T11:09:10 Use #if, not #ifdef with HAVE_ macros
Jim Meyering fd29624f 1997-12-25T16:49:08 Declare stpcpy only if not defined as macro.
Jim Meyering 667a7002 1997-11-30T14:20:17 (savedir): Revert last change. malloc always works when called with zero, because we use the wrapper if the system version is lacking.
Jim Meyering 6f82b55a 1997-11-30T10:24:41 (savedir): Check for size zero before invoking malloc; this can occur if st_size arg overflows on conversion to unsigned int. All callers now cast st_size arg to unsigned int.
Jim Meyering 53862d8f 1997-10-24T13:17:16 Use unsigned int, not just unsigned.
Jim Meyering 6644be6d 1997-10-04T01:43:58 (savedir): Declare DIR parameter to be const. Include savedir.h.
Jim Meyering 6d8337bf 1996-07-15T03:36:16 update FSF address in copyright
Jim Meyering 2516905b 1994-10-20T16:16:54 merge with 3.9p
Jim Meyering 180239d4 1994-10-17T14:01:44 .
Jim Meyering 300424a2 1994-10-02T05:43:03 merge with 3.9h
Jim Meyering 880bff09 1994-10-02T02:09:38 .
Jim Meyering af14c9a7 1994-07-30T12:10:53 .
Jim Meyering d87c3946 1992-10-31T20:42:48 Initial revision