largefile: fix typo that regressed large file support
[gnulib.git] / lib / getcwd-lgpl.c
index a5596f8..2761422 100644 (file)
@@ -45,7 +45,14 @@ rpl_getcwd (char *buf, size_t size)
 
   /* Handle single size operations.  */
   if (buf)
-    return getcwd (buf, size);
+    {
+      if (!size)
+        {
+          errno = EINVAL;
+          return NULL;
+        }
+      return getcwd (buf, size);
+    }
 
   if (size)
     {
@@ -53,7 +60,7 @@ rpl_getcwd (char *buf, size_t size)
       if (!buf)
         {
           errno = ENOMEM;
-          return -1;
+          return NULL;
         }
       result = getcwd (buf, size);
       if (!result)