Age | Commit message (Collapse) | Author |
|
|
|
|
|
fix the HAVE_GETCWD_NULL code to behave more like the
!HAVE_GETCWD_NULL code used to.
Include "xalloc.h".
(xgetcwd): Do not return NULL when memory is exhausted; instead,
invoke xalloc_die.
|
|
like the HAVE_GETCWD_NULL code.
Include pathmax.h if not HAVE_GETCWD.
Do not include xalloc.h.
(INITIAL_BUFFER_SIZE): New symbol.
Do not use xmalloc / xrealloc, since the caller is responsible for
handling errors. Preserve errno around `free' during failure.
Do not overrun buffer when using getwd.
|
|
to decide whether to use getcwd (NULL, 0).
|
|
|
|
Use an initial, malloc'd, buffer of length 128 rather than
a statically allocated one of length 1024.
|
|
Include stdlib.h and unistd.h if available.
Include xalloc.h.
(xmalloc, xstrdup, free): Remove decls.
(xgetcwd): Don't assume sizes fit in unsigned.
Check for overflow when computing sizes.
Simplify reallocation code.
|
|
Simply `return getcwd (NULL, 0);'.
[! (defined __GLIBC__ && __GLIBC__ >= 2)]:
Use 1300 as initial value for length, not PATH_MAX.
|
|
than 1024, return a memory chunk of least possible size, instead
of size PATH_MAX + 2. In the loop, increment the size proportionally.
Use free/xmalloc instead of xrealloc to avoid copying for very long paths.
|
|
|
|
|
|
|
|
|
|
|