Commit 224f4ec1 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

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.
parent beb6d07d
2013-01-27 Eli Zaretskii <eliz@gnu.org>
* 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 <eliz@gnu.org>
 
* w32.c (parse_root, get_volume_info, readdir, read_unc_volume)
......
......@@ -3124,9 +3124,12 @@ sys_open (const char * path, int oflag, int mode)
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 @@ sys_close (int fd)
}
}
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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment