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

Ken Thomases ken at codeweavers.com
Wed Feb 28 14:04:54 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/winspool.drv/info.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c
index 891d661..7c6d9af 100644
--- a/dlls/winspool.drv/info.c
+++ b/dlls/winspool.drv/info.c
@@ -7218,8 +7218,8 @@ #ifdef HAVE_FORK
         signal(SIGPIPE, SIG_DFL);
         signal(SIGCHLD, SIG_DFL);
 
-        system(cmdA);
-        exit(0);
+        execl("/bin/sh", "/bin/sh", "-c", cmdA, (char*)0);
+        _exit(1);
     }
 
     while((no_read = read(file_fd, buf, sizeof(buf))) > 0)


More information about the wine-patches mailing list