]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Make it work on Woe32.
authorBruno Haible <bruno@clisp.org>
Sat, 17 May 2003 14:55:33 +0000 (14:55 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:10:30 +0000 (12:10 +0200)
gettext-tools/lib/ChangeLog
gettext-tools/lib/execute.c
gettext-tools/lib/w32spawn.h

index 8265fee9b4d5e741c12944cbfbe4f6def6a31d77..6788a7e5063228e26a6ee60454131bca48112ac7 100644 (file)
@@ -3,6 +3,12 @@
        * Makefile.msvc (OBJECTS): Remove strpbrk.obj.
        (strpbrk.obj): Remove rule.
 
+       * w32spawn.h (dup_noinherit): Cast _get_osfhandle result and
+       _open_osfhandle argument, to avoid warnings.
+       (prepare_spawn): Add a cast.
+       * execute.c (execute) [WIN32]: Don't call wait_subprocess; the
+       return value from spawnvp is already the exit code.
+
 2003-05-10  Bruno Haible  <bruno@clisp.org>
 
        * linebreak.c (iconv_string_length): Don't return -1 just because the
index 6754bc1ad50ed031b2aaab28ecf75a3a980f65e1..3c8be27c104448fb3ae5ffec76641d5074e74692 100644 (file)
@@ -122,7 +122,7 @@ execute (const char *progname,
   int orig_stdin;
   int orig_stdout;
   int orig_stderr;
-  int child;
+  int exitcode;
   int nullinfd;
   int nulloutfd;
 
@@ -135,7 +135,7 @@ execute (const char *progname,
     orig_stdout = dup_noinherit (STDOUT_FILENO);
   if (null_stderr)
     orig_stderr = dup_noinherit (STDERR_FILENO);
-  child = -1;
+  exitcode = -1;
 
   /* Create standard file handles of child process.  */
   nullinfd = -1;
@@ -156,7 +156,7 @@ execute (const char *progname,
              && ((null_stdout && nulloutfd == STDOUT_FILENO)
                  || (null_stderr && nulloutfd == STDERR_FILENO)
                  || close (nulloutfd) >= 0))))
-    child = spawnvp (P_WAIT, prog_path, prog_argv);
+    exitcode = spawnvp (P_WAIT, prog_path, prog_argv);
   if (nulloutfd >= 0)
     close (nulloutfd);
   if (nullinfd >= 0)
@@ -170,7 +170,7 @@ execute (const char *progname,
   if (null_stdin)
     dup2 (orig_stdin, STDIN_FILENO), close (orig_stdin);
 
-  if (child == -1)
+  if (exitcode == -1)
     {
       if (exit_on_error)
        error (EXIT_FAILURE, errno, _("%s subprocess failed"), progname);
@@ -178,6 +178,8 @@ execute (const char *progname,
        return 127;
     }
 
+  return exitcode;
+
 #else
 
   /* Unix API.  */
@@ -263,9 +265,9 @@ execute (const char *progname,
       else
        return 127;
     }
-#endif
-
 #endif
 
   return wait_subprocess (child, progname, exit_on_error);
+
+#endif
 }
index e5c5c8e2a04f0006122d8bb336de60b8e0666d8b..ac3792678edf18bb85daa2740805f2f16581be4e 100644 (file)
@@ -34,7 +34,7 @@ static int
 dup_noinherit (int fd)
 {
   HANDLE curr_process = GetCurrentProcess ();
-  HANDLE old_handle = _get_osfhandle (fd);
+  HANDLE old_handle = (HANDLE) _get_osfhandle (fd);
   HANDLE new_handle;
   int nfd;
 
@@ -48,7 +48,7 @@ dup_noinherit (int fd)
     error (EXIT_FAILURE, 0, _("DuplicateHandle failed with error code 0x%08x"),
           GetLastError ());
 
-  nfd = _open_osfhandle (new_handle, O_BINARY);
+  nfd = _open_osfhandle ((long) new_handle, O_BINARY);
   if (nfd < 0)
     error (EXIT_FAILURE, errno, _("_open_osfhandle failed"));
 
@@ -161,7 +161,7 @@ prepare_spawn (char **argv)
          new_argv[i] = quoted_string;
        }
       else
-       new_argv[i] = string;
+       new_argv[i] = (char *) string;
     }
   new_argv[argc] = NULL;