diff options
| author | Paul Eggert | 2017-05-08 10:46:21 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-05-08 10:49:12 -0700 |
| commit | 7ff7624a7aa62f30cabf14744e182e9ea6156290 (patch) | |
| tree | 6e6e1f2f1226a637f366f16fb4ec2122d0ce72c3 /lib | |
| parent | e93f39d2e6b56319511f778e85da32ba05359668 (diff) | |
| download | emacs-7ff7624a7aa62f30cabf14744e182e9ea6156290.tar.gz emacs-7ff7624a7aa62f30cabf14744e182e9ea6156290.zip | |
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.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/intprops.h | 20 | ||||
| -rw-r--r-- | lib/utimens.c | 18 |
2 files changed, 15 insertions, 23 deletions
diff --git a/lib/intprops.h b/lib/intprops.h index 1ea9647e16e..8f5ad545154 100644 --- a/lib/intprops.h +++ b/lib/intprops.h | |||
| @@ -21,7 +21,6 @@ | |||
| 21 | #define _GL_INTPROPS_H | 21 | #define _GL_INTPROPS_H |
| 22 | 22 | ||
| 23 | #include <limits.h> | 23 | #include <limits.h> |
| 24 | #include <verify.h> | ||
| 25 | 24 | ||
| 26 | /* Return a value with the common real type of E and V and the value of V. */ | 25 | /* Return a value with the common real type of E and V and the value of V. */ |
| 27 | #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) | 26 | #define _GL_INT_CONVERT(e, v) (0 * (e) + (v)) |
| @@ -80,24 +79,7 @@ | |||
| 80 | /* This include file assumes that signed types are two's complement without | 79 | /* This include file assumes that signed types are two's complement without |
| 81 | padding bits; the above macros have undefined behavior otherwise. | 80 | padding bits; the above macros have undefined behavior otherwise. |
| 82 | If this is a problem for you, please let us know how to fix it for your host. | 81 | If this is a problem for you, please let us know how to fix it for your host. |
| 83 | As a sanity check, test the assumption for some signed types that | 82 | This assumption is tested by the intprops-tests module. */ |
| 84 | <limits.h> bounds. */ | ||
| 85 | verify (TYPE_MINIMUM (signed char) == SCHAR_MIN); | ||
| 86 | verify (TYPE_MAXIMUM (signed char) == SCHAR_MAX); | ||
| 87 | verify (TYPE_MINIMUM (short int) == SHRT_MIN); | ||
| 88 | verify (TYPE_MAXIMUM (short int) == SHRT_MAX); | ||
| 89 | verify (TYPE_MINIMUM (int) == INT_MIN); | ||
| 90 | verify (TYPE_MAXIMUM (int) == INT_MAX); | ||
| 91 | verify (TYPE_MINIMUM (long int) == LONG_MIN); | ||
| 92 | verify (TYPE_MAXIMUM (long int) == LONG_MAX); | ||
| 93 | #ifdef LLONG_MAX | ||
| 94 | verify (TYPE_MINIMUM (long long int) == LLONG_MIN); | ||
| 95 | verify (TYPE_MAXIMUM (long long int) == LLONG_MAX); | ||
| 96 | #endif | ||
| 97 | /* Similarly, sanity-check one ISO/IEC TS 18661-1:2014 macro if defined. */ | ||
| 98 | #ifdef UINT_WIDTH | ||
| 99 | verify (TYPE_WIDTH (unsigned int) == UINT_WIDTH); | ||
| 100 | #endif | ||
| 101 | 83 | ||
| 102 | /* Does the __typeof__ keyword work? This could be done by | 84 | /* Does the __typeof__ keyword work? This could be done by |
| 103 | 'configure', but for now it's easier to do it by hand. */ | 85 | 'configure', but for now it's easier to do it by hand. */ |
diff --git a/lib/utimens.c b/lib/utimens.c index 5f3a846ea2f..b4bfa8e3222 100644 --- a/lib/utimens.c +++ b/lib/utimens.c | |||
| @@ -349,11 +349,19 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) | |||
| 349 | return 0; | 349 | return 0; |
| 350 | else | 350 | else |
| 351 | { | 351 | { |
| 352 | #if 0 | ||
| 353 | DWORD sft_error = GetLastError (); | 352 | DWORD sft_error = GetLastError (); |
| 354 | fprintf (stderr, "utime SetFileTime error 0x%x\n", (unsigned int) sft_error); | 353 | #if 0 |
| 354 | fprintf (stderr, "fdutimens SetFileTime error 0x%x\n", (unsigned int) sft_error); | ||
| 355 | #endif | 355 | #endif |
| 356 | errno = EINVAL; | 356 | switch (sft_error) |
| 357 | { | ||
| 358 | case ERROR_ACCESS_DENIED: /* fd was opened without O_RDWR */ | ||
| 359 | errno = EACCES; /* not specified by POSIX */ | ||
| 360 | break; | ||
| 361 | default: | ||
| 362 | errno = EINVAL; | ||
| 363 | break; | ||
| 364 | } | ||
| 357 | return -1; | 365 | return -1; |
| 358 | } | 366 | } |
| 359 | } | 367 | } |
| @@ -465,7 +473,9 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) | |||
| 465 | return -1; | 473 | return -1; |
| 466 | } | 474 | } |
| 467 | 475 | ||
| 468 | #if HAVE_WORKING_UTIMES | 476 | #ifdef USE_SETFILETIME |
| 477 | return _gl_utimens_windows (file, ts); | ||
| 478 | #elif HAVE_WORKING_UTIMES | ||
| 469 | return utimes (file, t); | 479 | return utimes (file, t); |
| 470 | #else | 480 | #else |
| 471 | { | 481 | { |