Foix compilation with MSVC.
authorEli Zaretskii <eliz@gnu.org>
Mon, 7 Oct 2013 16:14:01 +0000 (19:14 +0300)
committerEli Zaretskii <eliz@gnu.org>
Mon, 7 Oct 2013 16:14:01 +0000 (19:14 +0300)
 w32/compat/posixfcn.c (tmpfile): Move declaration of h before
 the first executable statement.  Reported by Gisle Vanem <gvanem@yahoo.no>.

ChangeLog
w32/compat/posixfcn.c

index 19165ac4b8bce636666facb3001dae9bbbeacb23..eccd2116ca98cd80bdf1df2e5586d6d609b0e9de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * makeint.h (MAP_USERFUNC): A new map type for function names.
index 0ebf9a61ef5f6f3d299ee956b05278eb356df1df..560110f899a4177de5cbe6ba350a8d2428ca76f4 100644 (file)
@@ -301,19 +301,21 @@ tmpfile (void)
          path_size + sizemax < sizeof temp_path &&
          !(uniq >= 0x10000 && second_loop))
     {
+      HANDLE h;
+
       sprintf (temp_path + path_size,
               "%s%s%u-%x.tmp",
               temp_path[path_size - 1] == '\\' ? "" : "\\",
               base, pid, uniq);
-      HANDLE h = CreateFile (temp_path,  /* file name */
-                             GENERIC_READ | GENERIC_WRITE | DELETE, /* desired access */
-                             FILE_SHARE_READ | FILE_SHARE_WRITE,    /* share mode */
-                             NULL,                         /* default security attributes */
-                             CREATE_NEW,                   /* creation disposition */
-                             FILE_ATTRIBUTE_NORMAL |       /* flags and attributes */
-                             FILE_ATTRIBUTE_TEMPORARY |
-                             FILE_FLAG_DELETE_ON_CLOSE,
-                             NULL);                        /* no template file */
+      h = CreateFile (temp_path,  /* file name */
+                     GENERIC_READ | GENERIC_WRITE | DELETE, /* desired access */
+                     FILE_SHARE_READ | FILE_SHARE_WRITE,    /* share mode */
+                     NULL,                                  /* default security attributes */
+                     CREATE_NEW,                            /* creation disposition */
+                     FILE_ATTRIBUTE_NORMAL |                /* flags and attributes */
+                     FILE_ATTRIBUTE_TEMPORARY |
+                     FILE_FLAG_DELETE_ON_CLOSE,
+                     NULL);                                 /* no template file */
 
       if (h == INVALID_HANDLE_VALUE)
         {