[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master bdcea81: Pass C string pointer to current directory to 'child_set
From: |
Philipp Stephani |
Subject: |
master bdcea81: Pass C string pointer to current directory to 'child_setup'. |
Date: |
Wed, 23 Dec 2020 10:28:11 -0500 (EST) |
branch: master
commit bdcea81a2f906be3c573c42276dbfd35ccb432f9
Author: Philipp Stephani <phst@google.com>
Commit: Philipp Stephani <phst@google.com>
Pass C string pointer to current directory to 'child_setup'.
This avoids the impression that 'child_setup' could do anything
Lisp-related.
* src/callproc.c (child_setup): Pass C pointer to current directory
name.
(call_process): Adapt callers.
* src/process.c (create_process): Adapt callers.
---
src/callproc.c | 16 +++++++++-------
src/lisp.h | 2 +-
src/process.c | 6 ++++--
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/callproc.c b/src/callproc.c
index 93a8bb8..bd8442c 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -544,8 +544,8 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int
filefd,
char *const *env = make_environment_block (current_dir);
#ifdef MSDOS /* MW, July 1993 */
- status
- = child_setup (filefd, fd_output, fd_error, new_argv, env, current_dir);
+ status = child_setup (filefd, fd_output, fd_error, new_argv, env,
+ SSDATA (current_dir));
if (status < 0)
{
@@ -592,7 +592,8 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int
filefd,
block_child_signal (&oldset);
#ifdef WINDOWSNT
- pid = child_setup (filefd, fd_output, fd_error, new_argv, env, current_dir);
+ pid = child_setup (filefd, fd_output, fd_error, new_argv, env,
+ SSDATA (current_dir));
#else /* not WINDOWSNT */
/* vfork, and prevent local vars from being clobbered by the vfork. */
@@ -651,7 +652,8 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int
filefd,
signal (SIGPROF, SIG_DFL);
#endif
- child_setup (filefd, fd_output, fd_error, new_argv, env, current_dir);
+ child_setup (filefd, fd_output, fd_error, new_argv, env,
+ SSDATA (current_dir));
}
#endif /* not WINDOWSNT */
@@ -1221,7 +1223,7 @@ exec_failed (char const *name, int err)
CHILD_SETUP_TYPE
child_setup (int in, int out, int err, char **new_argv, char *const *env,
- Lisp_Object current_dir)
+ const char *current_dir)
{
#ifdef WINDOWSNT
int cpid;
@@ -1243,13 +1245,13 @@ child_setup (int in, int out, int err, char **new_argv,
char *const *env,
should only return an error if the directory's permissions
are changed between the check and this chdir, but we should
at least check. */
- if (chdir (SSDATA (current_dir)) < 0)
+ if (chdir (current_dir) < 0)
_exit (EXIT_CANCELED);
#endif
#ifdef WINDOWSNT
prepare_standard_handles (in, out, err, handles);
- set_process_dir (SSDATA (current_dir));
+ set_process_dir (current_dir);
/* Spawn the child. (See w32proc.c:sys_spawnve). */
cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
reset_standard_handles (in, out, err, handles);
diff --git a/src/lisp.h b/src/lisp.h
index d20e69f..07ba2bc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4501,7 +4501,7 @@ extern void setup_process_coding_systems (Lisp_Object);
#endif
extern CHILD_SETUP_TYPE child_setup (int, int, int, char **, char *const *,
- Lisp_Object);
+ const char *);
extern char *const *make_environment_block (Lisp_Object);
extern void init_callproc_1 (void);
extern void init_callproc (void);
diff --git a/src/process.c b/src/process.c
index c579078..15b4a23 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2259,9 +2259,11 @@ create_process (Lisp_Object process, char **new_argv,
Lisp_Object current_dir)
if (forkerr < 0)
forkerr = forkout;
#ifdef WINDOWSNT
- pid = child_setup (forkin, forkout, forkerr, new_argv, env, current_dir);
+ pid = child_setup (forkin, forkout, forkerr, new_argv, env,
+ SSDATA (current_dir));
#else /* not WINDOWSNT */
- child_setup (forkin, forkout, forkerr, new_argv, env, current_dir);
+ child_setup (forkin, forkout, forkerr, new_argv, env,
+ SSDATA (current_dir));
#endif /* not WINDOWSNT */
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master bdcea81: Pass C string pointer to current directory to 'child_setup'.,
Philipp Stephani <=