Imported from ../bash-3.2.48.tar.gz.

This commit is contained in:
Jari Aalto 2008-11-18 13:15:12 +00:00
commit f1be666c7d
47 changed files with 703 additions and 159 deletions

View file

@ -251,19 +251,21 @@ getcwd (buf, size)
{
size_t len = pathbuf + pathsize - pathp;
if (buf == NULL)
{
if (len < (size_t) size)
len = size;
buf = (char *) malloc (len);
if (buf == NULL)
goto lose2;
}
else if ((size_t) size < len)
if (buf == NULL && size <= 0)
size = len;
if ((size_t) size < len)
{
errno = ERANGE;
goto lose2;
}
if (buf == NULL)
{
buf = (char *) malloc (size);
if (buf == NULL)
goto lose2;
}
(void) memcpy((PTR_T) buf, (PTR_T) pathp, len);
}