[commit: packages/process] master: Revert "Addresses comments from #45. Feel free to squash." (296535e)

git at git.haskell.org git at git.haskell.org
Mon Nov 2 06:24:19 UTC 2015


Repository : ssh://git@git.haskell.org/process

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/296535ef2d1b0d6051a1db8adf402549acd87557/process

>---------------------------------------------------------------

commit 296535ef2d1b0d6051a1db8adf402549acd87557
Author: jprider63 <jp at jamesparker.me>
Date:   Wed Oct 14 10:20:51 2015 -0400

    Revert "Addresses comments from #45. Feel free to squash."
    
    This reverts commit 932fe345925950da9c9f6afd254d494257f2fa2b.


>---------------------------------------------------------------

296535ef2d1b0d6051a1db8adf402549acd87557
 System/Process/Internals.hs | 14 +++++++-------
 cbits/runProcess.c          | 10 +++++-----
 include/runProcess.h        |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/System/Process/Internals.hs b/System/Process/Internals.hs
index f9a5800..7d65546 100644
--- a/System/Process/Internals.hs
+++ b/System/Process/Internals.hs
@@ -197,12 +197,12 @@ data CreateProcess = CreateProcess{
                                            --
                                            --   Default: @Nothing@
                                            --
-                                           --   @since 1.4.0.0
+                                           --   @since X.X.X.X
   child_user :: Maybe UserID               -- ^ Use posix setuid to set child process's user id; does nothing on other platforms.
                                            --
                                            --   Default: @Nothing@
                                            --
-                                           --   @since 1.4.0.0
+                                           --   @since X.X.X.X
  }
 
 data CmdSpec
@@ -295,8 +295,8 @@ createProcess_ fun CreateProcess{ cmdspec = cmdsp,
    alloca $ \ pFailedDoing ->
    maybeWith withCEnvironment mb_env $ \pEnv ->
    maybeWith withFilePath mb_cwd $ \pWorkDir ->
-   let childGroup = maybe (-1) id mb_child_group in
-   let childUser = maybe (-1) id mb_child_user in
+   maybeWith with mb_child_group $ \pChildGroup ->
+   maybeWith with mb_child_user $ \pChildUser ->
    withMany withFilePath (cmd:args) $ \cstrs ->
    withArray0 nullPtr cstrs $ \pargs -> do
 
@@ -315,7 +315,7 @@ createProcess_ fun CreateProcess{ cmdspec = cmdsp,
                          c_runInteractiveProcess pargs pWorkDir pEnv
                                 fdin fdout fderr
                                 pfdStdInput pfdStdOutput pfdStdError
-                                childGroup childUser
+                                pChildGroup pChildUser
                                 (if mb_delegate_ctlc then 1 else 0)
                                 ((if mb_close_fds then RUN_PROCESS_IN_CLOSE_FDS else 0)
                                 .|.(if mb_create_group then RUN_PROCESS_IN_NEW_GROUP else 0)
@@ -429,8 +429,8 @@ foreign import ccall unsafe "runInteractiveProcess"
         -> Ptr FD
         -> Ptr FD
         -> Ptr FD
-        -> CGid
-        -> CUid
+        -> Ptr CGid
+        -> Ptr CUid
         -> CInt                         -- reset child's SIGINT & SIGQUIT handlers
         -> CInt                         -- flags
         -> Ptr CString
diff --git a/cbits/runProcess.c b/cbits/runProcess.c
index 9059004..950635d 100644
--- a/cbits/runProcess.c
+++ b/cbits/runProcess.c
@@ -61,7 +61,7 @@ runInteractiveProcess (char *const args[],
                        char *workingDirectory, char **environment,
                        int fdStdIn, int fdStdOut, int fdStdErr,
                        int *pfdStdInput, int *pfdStdOutput, int *pfdStdError,
-                       gid_t childGroup, uid_t childUser,
+                       gid_t *childGroup, uid_t *childUser,
                        int reset_int_quit_handlers,
                        int flags,
                        char **failed_doing)
@@ -150,15 +150,15 @@ runInteractiveProcess (char *const args[],
             setpgid(0, 0);
         }
         
-        if ( childGroup != -1) {
-            if ( setgid( childGroup) != 0) {
+        if ( childGroup) {
+            if ( setgid( *childGroup) != 0) {
                 // ERROR
                 childFailed(forkCommunicationFds[1], forkSetgidFailed);
             }
         }
 
-        if ( childUser  != -1) {
-            if ( setuid( childUser) != 0) {
+        if ( childUser) {
+            if ( setuid( *childUser) != 0) {
                 // ERROR
                 childFailed(forkCommunicationFds[1], forkSetuidFailed);
             }
diff --git a/include/runProcess.h b/include/runProcess.h
index da27593..d35e3e4 100644
--- a/include/runProcess.h
+++ b/include/runProcess.h
@@ -62,8 +62,8 @@ extern ProcHandle runInteractiveProcess( char *const args[],
                                          int *pfdStdInput, 
                                          int *pfdStdOutput, 
                                          int *pfdStdError,
-                                         gid_t childGroup,
-                                         uid_t childUser,
+                                         gid_t *childGroup,
+                                         uid_t *childUser,
                                          int reset_int_quit_handlers,
                                          int flags,
                                          char **failed_doing);



More information about the ghc-commits mailing list