[commit: packages/process] master: Addresses comments from #45. Feel free to squash. (932fe34)
git at git.haskell.org
git at git.haskell.org
Mon Nov 2 06:24:17 UTC 2015
Repository : ssh://git@git.haskell.org/process
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/932fe345925950da9c9f6afd254d494257f2fa2b/process
>---------------------------------------------------------------
commit 932fe345925950da9c9f6afd254d494257f2fa2b
Author: jprider63 <jp at jamesparker.me>
Date: Wed Oct 14 08:26:53 2015 -0400
Addresses comments from #45. Feel free to squash.
>---------------------------------------------------------------
932fe345925950da9c9f6afd254d494257f2fa2b
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 7d65546..f9a5800 100644
--- a/System/Process/Internals.hs
+++ b/System/Process/Internals.hs
@@ -197,12 +197,12 @@ data CreateProcess = CreateProcess{
--
-- Default: @Nothing@
--
- -- @since X.X.X.X
+ -- @since 1.4.0.0
child_user :: Maybe UserID -- ^ Use posix setuid to set child process's user id; does nothing on other platforms.
--
-- Default: @Nothing@
--
- -- @since X.X.X.X
+ -- @since 1.4.0.0
}
data CmdSpec
@@ -295,8 +295,8 @@ createProcess_ fun CreateProcess{ cmdspec = cmdsp,
alloca $ \ pFailedDoing ->
maybeWith withCEnvironment mb_env $ \pEnv ->
maybeWith withFilePath mb_cwd $ \pWorkDir ->
- maybeWith with mb_child_group $ \pChildGroup ->
- maybeWith with mb_child_user $ \pChildUser ->
+ let childGroup = maybe (-1) id mb_child_group in
+ let childUser = maybe (-1) id mb_child_user in
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
- pChildGroup pChildUser
+ childGroup childUser
(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
- -> Ptr CGid
- -> Ptr CUid
+ -> CGid
+ -> CUid
-> CInt -- reset child's SIGINT & SIGQUIT handlers
-> CInt -- flags
-> Ptr CString
diff --git a/cbits/runProcess.c b/cbits/runProcess.c
index 950635d..9059004 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) {
- if ( setgid( *childGroup) != 0) {
+ if ( childGroup != -1) {
+ if ( setgid( childGroup) != 0) {
// ERROR
childFailed(forkCommunicationFds[1], forkSetgidFailed);
}
}
- if ( childUser) {
- if ( setuid( *childUser) != 0) {
+ if ( childUser != -1) {
+ if ( setuid( childUser) != 0) {
// ERROR
childFailed(forkCommunicationFds[1], forkSetuidFailed);
}
diff --git a/include/runProcess.h b/include/runProcess.h
index d35e3e4..da27593 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