Foix compilation with MSVC.

w32/compat/posixfcn.c (tmpfile): Move declaration of h before
 the first executable statement.  Reported by Gisle Vanem <gvanem@yahoo.no>.
This commit is contained in:
Eli Zaretskii 2013-10-07 19:14:01 +03:00
parent b539908f73
commit b69b04dc8c
2 changed files with 17 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2013-10-07 Eli Zaretskii <eliz@gnu.org>
* w32/compat/posixfcn.c (tmpfile): Move declaration of h before
the first executable statement. Reported by Gisle Vanem
<gvanem@yahoo.no>.
2013-10-05 Paul Smith <psmith@gnu.org> 2013-10-05 Paul Smith <psmith@gnu.org>
* makeint.h (MAP_USERFUNC): A new map type for function names. * makeint.h (MAP_USERFUNC): A new map type for function names.

View File

@ -301,19 +301,21 @@ tmpfile (void)
path_size + sizemax < sizeof temp_path && path_size + sizemax < sizeof temp_path &&
!(uniq >= 0x10000 && second_loop)) !(uniq >= 0x10000 && second_loop))
{ {
HANDLE h;
sprintf (temp_path + path_size, sprintf (temp_path + path_size,
"%s%s%u-%x.tmp", "%s%s%u-%x.tmp",
temp_path[path_size - 1] == '\\' ? "" : "\\", temp_path[path_size - 1] == '\\' ? "" : "\\",
base, pid, uniq); base, pid, uniq);
HANDLE h = CreateFile (temp_path, /* file name */ h = CreateFile (temp_path, /* file name */
GENERIC_READ | GENERIC_WRITE | DELETE, /* desired access */ GENERIC_READ | GENERIC_WRITE | DELETE, /* desired access */
FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */
NULL, /* default security attributes */ NULL, /* default security attributes */
CREATE_NEW, /* creation disposition */ CREATE_NEW, /* creation disposition */
FILE_ATTRIBUTE_NORMAL | /* flags and attributes */ FILE_ATTRIBUTE_NORMAL | /* flags and attributes */
FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_TEMPORARY |
FILE_FLAG_DELETE_ON_CLOSE, FILE_FLAG_DELETE_ON_CLOSE,
NULL); /* no template file */ NULL); /* no template file */
if (h == INVALID_HANDLE_VALUE) if (h == INVALID_HANDLE_VALUE)
{ {