gdi32: Use exec() and _exit() instead of system() and exit().

Ken Thomases ken at codeweavers.com
Wed Feb 28 14:04:48 CST 2007


This avoids the creation of an extra process and cleans up with fewer side
effects.  In particular on Mac OS X, when you fork a process with was using
Core Audio, it leaves the child in an inconsistent state.  It has registered
functions with atexit() which crash because the child does not have the
expected properties (threads and run-loops).
---
  dlls/gdi32/printdrv.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/dlls/gdi32/printdrv.c b/dlls/gdi32/printdrv.c
index caf4e14..15bcada 100644
--- a/dlls/gdi32/printdrv.c
+++ b/dlls/gdi32/printdrv.c
@@ -505,8 +505,8 @@ #ifdef HAVE_FORK
             signal( SIGPIPE, SIG_DFL );
             signal( SIGCHLD, SIG_DFL );
 
-            system(psCmdP);
-            exit(0);
+            execl("/bin/sh", "/bin/sh", "-c", psCmdP, (char*)0);
+            _exit(1);
 
         }
         close (fds[0]);


More information about the wine-patches mailing list