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.
This commit is contained in:
Philipp Stephani 2020-12-23 16:26:57 +01:00
parent 95334ee79a
commit bdcea81a2f
3 changed files with 14 additions and 10 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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 */
}