* lib/utimens.c (fdutimens): If fd was not opened with O_RDWR, fail with
error code EACCES, not EINVAL.
+2017-05-07 Bruno Haible <bruno@clisp.org>
+
+ utimens: Improve error code on native Windows.
+ * lib/utimens.c (fdutimens): If fd was not opened with O_RDWR, fail with
+ error code EACCES, not EINVAL.
+
2017-05-07 Bruno Haible <bruno@clisp.org>
utime: Handle more Windows error codes.
return 0;
else
{
- #if 0
DWORD sft_error = GetLastError ();
- fprintf (stderr, "utime SetFileTime error 0x%x\n", (unsigned int) sft_error);
+ #if 0
+ fprintf (stderr, "fdutimens SetFileTime error 0x%x\n", (unsigned int) sft_error);
#endif
- errno = EINVAL;
+ switch (sft_error)
+ {
+ case ERROR_ACCESS_DENIED: /* fd was opened without O_RDWR */
+ errno = EACCES; /* not specified by POSIX */
+ break;
+ default:
+ errno = EINVAL;
+ break;
+ }
return -1;
}
}