emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 ec9fbad908: Fix write-region to null device on MS-Windows


From: Eli Zaretskii
Subject: emacs-29 ec9fbad908: Fix write-region to null device on MS-Windows
Date: Wed, 21 Dec 2022 14:25:09 -0500 (EST)

branch: emacs-29
commit ec9fbad908d5f65f71717506d070a40acca89f5b
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix write-region to null device on MS-Windows
    
    * src/fileio.c (write_region) [WINDOWSNT]: Ignore EBADF errors
    from fsync -- this means fsync is not supported for this file.
    Happens, for example, with the null device.  (Bug#59545)
---
 src/fileio.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/fileio.c b/src/fileio.c
index 835c42cc0a..31353be5d5 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5387,12 +5387,16 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
     {
       /* Transfer data and metadata to disk, retrying if interrupted.
         fsync can report a write failure here, e.g., due to disk full
-        under NFS.  But ignore EINVAL, which means fsync is not
-        supported on this file.  */
+        under NFS.  But ignore EINVAL (and EBADF on Windows), which
+        means fsync is not supported on this file.  */
       while (fsync (desc) != 0)
        if (errno != EINTR)
          {
-           if (errno != EINVAL)
+           if (errno != EINVAL
+#ifdef WINDOWSNT
+               && errno != EBADF
+#endif
+               )
              ok = 0, save_errno = errno;
            break;
          }



reply via email to

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