/* Handle single size operations. */
if (buf)
- return getcwd (buf, size);
+ {
+ if (!size)
+ {
+ errno = EINVAL;
+ return NULL;
+ }
+ return getcwd (buf, size);
+ }
if (size)
{
if (!buf)
{
errno = ENOMEM;
- return -1;
+ return NULL;
}
result = getcwd (buf, size);
if (!result)