emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7ff7624: Merge from gnulib


From: Paul Eggert
Subject: [Emacs-diffs] master 7ff7624: Merge from gnulib
Date: Mon, 8 May 2017 13:49:16 -0400 (EDT)

branch: master
commit 7ff7624a7aa62f30cabf14744e182e9ea6156290
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 lib/intprops.h | 20 +-------------------
 lib/utimens.c  | 18 ++++++++++++++----
 2 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/lib/intprops.h b/lib/intprops.h
index 1ea9647..8f5ad54 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -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.  */
diff --git a/lib/utimens.c b/lib/utimens.c
index 5f3a846..b4bfa8e 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -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
     {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]