Age | Commit message (Collapse) | Author |
|
Include savedir.h first, to test interface.
|
|
(NULL): Don't define, since <stddef.h> does 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.
|
|
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.
|
|
negative; this can happen with some screwy NFS configurations.
|
|
name_size is zero and the directory is empty.
|
|
|
|
|
|
|
|
|
|
|
|
works when called with zero, because we use the wrapper if the
system version is lacking.
|
|
malloc; this can occur if st_size arg overflows on conversion to
unsigned int. All callers now cast st_size arg to unsigned int.
|
|
|
|
Include savedir.h.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|