Merge from gnulib
This incorporates: 2017-05-08 intprops: don’t depend on ‘verify’ 2017-05-07 utimens: on native Windows, improve resolution if fd < 0 2017-05-07 utimens: Improve error code on native Windows * lib/intprops.h, lib/utimens.c: Copy from gnulib.
This commit is contained in:
parent
e93f39d2e6
commit
7ff7624a7a
2 changed files with 15 additions and 23 deletions
|
@ -21,7 +21,6 @@
|
|||
#define _GL_INTPROPS_H
|
||||
|
||||
#include <limits.h>
|
||||
#include <verify.h>
|
||||
|
||||
/* Return a value with the common real type of E and V and the value of V. */
|
||||
#define _GL_INT_CONVERT(e, v) (0 * (e) + (v))
|
||||
|
@ -80,24 +79,7 @@
|
|||
/* This include file assumes that signed types are two's complement without
|
||||
padding bits; the above macros have undefined behavior otherwise.
|
||||
If this is a problem for you, please let us know how to fix it for your host.
|
||||
As a sanity check, test the assumption for some signed types that
|
||||
<limits.h> bounds. */
|
||||
verify (TYPE_MINIMUM (signed char) == SCHAR_MIN);
|
||||
verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX);
|
||||
verify (TYPE_MINIMUM (short int) == SHRT_MIN);
|
||||
verify (TYPE_MAXIMUM (short int) == SHRT_MAX);
|
||||
verify (TYPE_MINIMUM (int) == INT_MIN);
|
||||
verify (TYPE_MAXIMUM (int) == INT_MAX);
|
||||
verify (TYPE_MINIMUM (long int) == LONG_MIN);
|
||||
verify (TYPE_MAXIMUM (long int) == LONG_MAX);
|
||||
#ifdef LLONG_MAX
|
||||
verify (TYPE_MINIMUM (long long int) == LLONG_MIN);
|
||||
verify (TYPE_MAXIMUM (long long int) == LLONG_MAX);
|
||||
#endif
|
||||
/* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */
|
||||
#ifdef UINT_WIDTH
|
||||
verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH);
|
||||
#endif
|
||||
This assumption is tested by the intprops-tests module. */
|
||||
|
||||
/* Does the __typeof__ keyword work? This could be done by
|
||||
'configure', but for now it's easier to do it by hand. */
|
||||
|
|
|
@ -349,11 +349,19 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
@ -465,7 +473,9 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if HAVE_WORKING_UTIMES
|
||||
#ifdef USE_SETFILETIME
|
||||
return _gl_utimens_windows (file, ts);
|
||||
#elif HAVE_WORKING_UTIMES
|
||||
return utimes (file, t);
|
||||
#else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue