emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111202: Tentative fix for bug #13


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111202: Tentative fix for bug #13546 with failure to save files on Windows.
Date: Sun, 27 Jan 2013 10:04:16 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111202
fixes bug: http://debbugs.gnu.org/13546
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Sun 2013-01-27 10:04:16 +0200
message:
  Tentative fix for bug #13546 with failure to save files on Windows.
  
   src/w32.c (sys_open): Zero out the flags for the new file descriptor.
   (sys_close): Zero out the flags for the file descriptor before
   closing it.
modified:
  src/ChangeLog
  src/w32.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-01-26 12:49:34 +0000
+++ b/src/ChangeLog     2013-01-27 08:04:16 +0000
@@ -1,3 +1,9 @@
+2013-01-27  Eli Zaretskii  <address@hidden>
+
+       * w32.c (sys_open): Zero out the flags for the new file descriptor.
+       (sys_close): Zero out the flags for the file descriptor before
+       closing it.  (Bug#13546)
+
 2013-01-26  Eli Zaretskii  <address@hidden>
 
        * w32.c (parse_root, get_volume_info, readdir, read_unc_volume)

=== modified file 'src/w32.c'
--- a/src/w32.c 2013-01-26 12:49:34 +0000
+++ b/src/w32.c 2013-01-27 08:04:16 +0000
@@ -3124,9 +3124,12 @@
      and system files. Force all file handles to be
      non-inheritable. */
   int res = _open (mpath, (oflag & ~_O_CREAT) | _O_NOINHERIT, mode);
-  if (res >= 0)
-    return res;
-  return _open (mpath, oflag | _O_NOINHERIT, mode);
+  if (res < 0)
+    res = _open (mpath, oflag | _O_NOINHERIT, mode);
+  if (res >= 0 && res < MAXDESC)
+    fd_info[res].flags = 0;
+
+  return res;
 }
 
 int
@@ -6135,15 +6138,15 @@
        }
     }
 
+  if (fd >= 0 && fd < MAXDESC)
+    fd_info[fd].flags = 0;
+
   /* Note that sockets do not need special treatment here (at least on
      NT and Windows 95 using the standard tcp/ip stacks) - it appears that
      closesocket is equivalent to CloseHandle, which is to be expected
      because socket handles are fully fledged kernel handles. */
   rc = _close (fd);
 
-  if (rc == 0 && fd < MAXDESC)
-    fd_info[fd].flags = 0;
-
   return rc;
 }
 


reply via email to

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