From 678f76fd408e3f482d291de995b624b3a8bd962e Mon Sep 17 00:00:00 2001 From: Shiro Kawai Date: Sun, 15 Sep 2024 18:13:50 -1000 Subject: [PATCH] Code cleanup --- src/system.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/system.c b/src/system.c index da58ac688..fb304dc40 100644 --- a/src/system.c +++ b/src/system.c @@ -1680,12 +1680,6 @@ ScmObj Scm_SysExec(ScmString *file, ScmObj args, ScmObj iomap, program = Scm_GetStringConst(file); } - /* Set up environment */ - char **envp = NULL; - if (SCM_LISTP(env)) { - envp = Scm_ListToCStringArray(env, TRUE, NULL); - } - /* * From now on, we have totally different code for Unix and Windows. */ @@ -1728,10 +1722,11 @@ ScmObj Scm_SysExec(ScmString *file, ScmObj args, ScmObj iomap, Scm_SysSigmask(SIG_SETMASK, mask); } - if (envp == NULL) { - execv(program, (char *const*)argv); + if (SCM_LISTP(env)) { + execve(program, (char *const*)argv, + Scm_ListToCStringArray(env, TRUE, NULL)); } else { - execve(program, (char *const*)argv, envp); + execv(program, (char *const*)argv); } /* here, we failed */ Scm_Panic("exec failed: %s: %s", program, strerror(errno));