lib/xgetcwd.c


Log

Author Commit Date CI Message
Jim Meyering c824c60f 2001-09-04T20:28:31 Revert some of the previous change; intead, 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.
Jim Meyering e6995fc5 2001-09-03T18:21:53 Fix the !HAVE_GETCWD_NULL code to behave more 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.
Jim Meyering b1d85350 2001-09-03T07:43:44 (xgetcwd): Use HAVE_GETCWD_NULL, not (defined __GLIBC__ && __GLIBC__ >= 2), to decide whether to use getcwd (NULL, 0).
Jim Meyering dec57211 2001-09-01T06:13:08 fix typo
Jim Meyering 904dc8bf 2001-08-31T11:39:16 (xgetcwd): Reorganize to avoid some duplication. Use an initial, malloc'd, buffer of length 128 rather than a statically allocated one of length 1024.
Jim Meyering f16f973a 2001-08-31T10:36:12 Don't include pathmax.h. 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.
Jim Meyering 9024bca2 2001-08-12T20:11:39 (xgetcwd) [defined __GLIBC__ && __GLIBC__ >= 2]: Simply `return getcwd (NULL, 0);'. [! (defined __GLIBC__ && __GLIBC__ >= 2)]: Use 1300 as initial value for length, not PATH_MAX.
Jim Meyering 4f796b14 2000-06-21T20:16:03 (xgetcwd): If the required pathname length is smaller 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.
Jim Meyering 16157cc4 1996-11-04T18:07:38 libitize
Jim Meyering f820ac46 1996-10-29T13:56:39 .
Jim Meyering 783c1624 1996-07-15T03:56:06 indent cpp-directives
Jim Meyering 6d8337bf 1996-07-15T03:36:16 update FSF address in copyright
Jim Meyering d282959b 1994-04-28T18:39:34 Initial revision