openat: detect Solaris fchownat bug
[pspp] / lib / at-func.c
index b6aa0fd550727f43893328ff25526b201a4f456e..73be401a3e3f2b1c8ee8329287499023fc9aa07a 100644 (file)
@@ -84,7 +84,7 @@ AT_FUNC_NAME (int fd, char const *file AT_FUNC_POST_FILE_PARAM_DECLS)
         /* If the syscall succeeds, or if it fails with an unexpected
            errno value, then return right away.  Otherwise, fall through
            and resort to using save_cwd/restore_cwd.  */
-        if (0 <= proc_result)
+        if (FUNC_FAIL != proc_result)
           return proc_result;
         if (! EXPECTED_ERRNO (proc_errno))
           {
@@ -115,7 +115,7 @@ AT_FUNC_NAME (int fd, char const *file AT_FUNC_POST_FILE_PARAM_DECLS)
     }
 
   err = CALL_FUNC (file);
-  saved_errno = (err < 0 ? errno : 0);
+  saved_errno = (err == FUNC_FAIL ? errno : 0);
 
   if (restore_cwd (&saved_cwd) != 0)
     openat_restore_fail (errno);