diff options
| author | Eli Zaretskii | 2020-12-24 17:58:51 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2020-12-24 17:58:51 +0200 |
| commit | 527cc64e5d7e8945dfb89bf44d5f4141bd221456 (patch) | |
| tree | 03c4df7a7d97fb4d56fe243118d4effde8245884 /src | |
| parent | 29064d02c31b08ae41d41a93fd1439718373b196 (diff) | |
| download | emacs-527cc64e5d7e8945dfb89bf44d5f4141bd221456.tar.gz emacs-527cc64e5d7e8945dfb89bf44d5f4141bd221456.zip | |
Unbreak the MinGW build broken by recent changes in callproc.c
* src/w32.h (set_process_dir):
* src/w32proc.c (set_process_dir): Change the argument to 'const
char *'.
* src/lisp.h (make_environment_block):
* src/callproc.c (make_environment_block): Now returns 'char **'.
(exec_failed) [DOS_NT]: Remove unused function.
* src/callproc.c (child_setup): NEW_ARGV and ENV are now 'char **'.
Making them 'const' breaks the MinGW build and is not needed for
other platforms.
* src/callproc.c (emacs_spawn): ARGV and ENVP arguments are now
'char *', for the same reason.
* src/process.c (create_process): Adapt to above changes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 71 | ||||
| -rw-r--r-- | src/lisp.h | 6 | ||||
| -rw-r--r-- | src/process.c | 2 | ||||
| -rw-r--r-- | src/w32.h | 2 | ||||
| -rw-r--r-- | src/w32proc.c | 4 |
5 files changed, 37 insertions, 48 deletions
diff --git a/src/callproc.c b/src/callproc.c index 8603382f0c3..e9502d2c4e8 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -107,8 +107,8 @@ static Lisp_Object call_process (ptrdiff_t, Lisp_Object *, int, ptrdiff_t); | |||
| 107 | # define CHILD_SETUP_TYPE _Noreturn void | 107 | # define CHILD_SETUP_TYPE _Noreturn void |
| 108 | #endif | 108 | #endif |
| 109 | 109 | ||
| 110 | static CHILD_SETUP_TYPE child_setup (int, int, int, char *const *, | 110 | static CHILD_SETUP_TYPE child_setup (int, int, int, char **, char **, |
| 111 | char *const *, const char *); | 111 | const char *); |
| 112 | 112 | ||
| 113 | /* Return the current buffer's working directory, or the home | 113 | /* Return the current buffer's working directory, or the home |
| 114 | directory if it's unreachable, as a string suitable for a system call. | 114 | directory if it's unreachable, as a string suitable for a system call. |
| @@ -549,7 +549,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 549 | callproc_fd[CALLPROC_STDERR] = fd_error; | 549 | callproc_fd[CALLPROC_STDERR] = fd_error; |
| 550 | } | 550 | } |
| 551 | 551 | ||
| 552 | char *const *env = make_environment_block (current_dir); | 552 | char **env = make_environment_block (current_dir); |
| 553 | 553 | ||
| 554 | #ifdef MSDOS /* MW, July 1993 */ | 554 | #ifdef MSDOS /* MW, July 1993 */ |
| 555 | status = child_setup (filefd, fd_output, fd_error, new_argv, env, | 555 | status = child_setup (filefd, fd_output, fd_error, new_argv, env, |
| @@ -1132,16 +1132,6 @@ exec_failed (char const *name, int err) | |||
| 1132 | _exit (err == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE); | 1132 | _exit (err == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE); |
| 1133 | } | 1133 | } |
| 1134 | 1134 | ||
| 1135 | #else | ||
| 1136 | |||
| 1137 | /* Do nothing. There is no need to fail, as DOS_NT platforms do not | ||
| 1138 | fork and exec, and handle alloca exhaustion in a different way. */ | ||
| 1139 | |||
| 1140 | static void | ||
| 1141 | exec_failed (char const *name, int err) | ||
| 1142 | { | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | #endif | 1135 | #endif |
| 1146 | 1136 | ||
| 1147 | /* This is the last thing run in a newly forked inferior | 1137 | /* This is the last thing run in a newly forked inferior |
| @@ -1160,8 +1150,8 @@ exec_failed (char const *name, int err) | |||
| 1160 | On MS-DOS, either return an exit status or signal an error. */ | 1150 | On MS-DOS, either return an exit status or signal an error. */ |
| 1161 | 1151 | ||
| 1162 | static CHILD_SETUP_TYPE | 1152 | static CHILD_SETUP_TYPE |
| 1163 | child_setup (int in, int out, int err, char *const *new_argv, | 1153 | child_setup (int in, int out, int err, char **new_argv, char **env, |
| 1164 | char *const *env, const char *current_dir) | 1154 | const char *current_dir) |
| 1165 | { | 1155 | { |
| 1166 | #ifdef WINDOWSNT | 1156 | #ifdef WINDOWSNT |
| 1167 | int cpid; | 1157 | int cpid; |
| @@ -1235,9 +1225,8 @@ child_setup (int in, int out, int err, char *const *new_argv, | |||
| 1235 | NULL, don't perform any terminal setup. */ | 1225 | NULL, don't perform any terminal setup. */ |
| 1236 | 1226 | ||
| 1237 | int | 1227 | int |
| 1238 | emacs_spawn (pid_t *newpid, int stdin, int stdout, int stderr, | 1228 | emacs_spawn (pid_t *newpid, int std_in, int std_out, int std_err, |
| 1239 | char *const *argv, char *const *envp, const char *cwd, | 1229 | char **argv, char **envp, const char *cwd, const char *pty) |
| 1240 | const char *pty) | ||
| 1241 | { | 1230 | { |
| 1242 | sigset_t oldset; | 1231 | sigset_t oldset; |
| 1243 | int pid; | 1232 | int pid; |
| @@ -1251,9 +1240,9 @@ emacs_spawn (pid_t *newpid, int stdin, int stdout, int stderr, | |||
| 1251 | const char *volatile cwd_volatile = cwd; | 1240 | const char *volatile cwd_volatile = cwd; |
| 1252 | const char *volatile pty_volatile = pty; | 1241 | const char *volatile pty_volatile = pty; |
| 1253 | char *const *volatile argv_volatile = argv; | 1242 | char *const *volatile argv_volatile = argv; |
| 1254 | int volatile stdin_volatile = stdin; | 1243 | int volatile stdin_volatile = std_in; |
| 1255 | int volatile stdout_volatile = stdout; | 1244 | int volatile stdout_volatile = std_out; |
| 1256 | int volatile stderr_volatile = stderr; | 1245 | int volatile stderr_volatile = std_err; |
| 1257 | char *const *volatile envp_volatile = envp; | 1246 | char *const *volatile envp_volatile = envp; |
| 1258 | 1247 | ||
| 1259 | #ifdef DARWIN_OS | 1248 | #ifdef DARWIN_OS |
| @@ -1272,9 +1261,9 @@ emacs_spawn (pid_t *newpid, int stdin, int stdout, int stderr, | |||
| 1272 | cwd = cwd_volatile; | 1261 | cwd = cwd_volatile; |
| 1273 | pty = pty_volatile; | 1262 | pty = pty_volatile; |
| 1274 | argv = argv_volatile; | 1263 | argv = argv_volatile; |
| 1275 | stdin = stdin_volatile; | 1264 | std_in = stdin_volatile; |
| 1276 | stdout = stdout_volatile; | 1265 | std_out = stdout_volatile; |
| 1277 | stderr = stderr_volatile; | 1266 | std_err = stderr_volatile; |
| 1278 | envp = envp_volatile; | 1267 | envp = envp_volatile; |
| 1279 | 1268 | ||
| 1280 | if (pid == 0) | 1269 | if (pid == 0) |
| @@ -1286,30 +1275,30 @@ emacs_spawn (pid_t *newpid, int stdin, int stdout, int stderr, | |||
| 1286 | dissociate_controlling_tty (); | 1275 | dissociate_controlling_tty (); |
| 1287 | 1276 | ||
| 1288 | /* Make the pty's terminal the controlling terminal. */ | 1277 | /* Make the pty's terminal the controlling terminal. */ |
| 1289 | if (pty_flag && stdin >= 0) | 1278 | if (pty_flag && std_in >= 0) |
| 1290 | { | 1279 | { |
| 1291 | #ifdef TIOCSCTTY | 1280 | #ifdef TIOCSCTTY |
| 1292 | /* We ignore the return value | 1281 | /* We ignore the return value |
| 1293 | because faith@cs.unc.edu says that is necessary on Linux. */ | 1282 | because faith@cs.unc.edu says that is necessary on Linux. */ |
| 1294 | ioctl (stdin, TIOCSCTTY, 0); | 1283 | ioctl (std_in, TIOCSCTTY, 0); |
| 1295 | #endif | 1284 | #endif |
| 1296 | } | 1285 | } |
| 1297 | #if defined (LDISC1) | 1286 | #if defined (LDISC1) |
| 1298 | if (pty_flag && stdin >= 0) | 1287 | if (pty_flag && std_in >= 0) |
| 1299 | { | 1288 | { |
| 1300 | struct termios t; | 1289 | struct termios t; |
| 1301 | tcgetattr (stdin, &t); | 1290 | tcgetattr (std_in, &t); |
| 1302 | t.c_lflag = LDISC1; | 1291 | t.c_lflag = LDISC1; |
| 1303 | if (tcsetattr (stdin, TCSANOW, &t) < 0) | 1292 | if (tcsetattr (std_in, TCSANOW, &t) < 0) |
| 1304 | emacs_perror ("create_process/tcsetattr LDISC1"); | 1293 | emacs_perror ("create_process/tcsetattr LDISC1"); |
| 1305 | } | 1294 | } |
| 1306 | #else | 1295 | #else |
| 1307 | #if defined (NTTYDISC) && defined (TIOCSETD) | 1296 | #if defined (NTTYDISC) && defined (TIOCSETD) |
| 1308 | if (pty_flag && stdin >= 0) | 1297 | if (pty_flag && std_in >= 0) |
| 1309 | { | 1298 | { |
| 1310 | /* Use new line discipline. */ | 1299 | /* Use new line discipline. */ |
| 1311 | int ldisc = NTTYDISC; | 1300 | int ldisc = NTTYDISC; |
| 1312 | ioctl (stdin, TIOCSETD, &ldisc); | 1301 | ioctl (std_in, TIOCSETD, &ldisc); |
| 1313 | } | 1302 | } |
| 1314 | #endif | 1303 | #endif |
| 1315 | #endif | 1304 | #endif |
| @@ -1327,11 +1316,11 @@ emacs_spawn (pid_t *newpid, int stdin, int stdout, int stderr, | |||
| 1327 | 1316 | ||
| 1328 | /* I wonder if emacs_close (emacs_open (pty, ...)) | 1317 | /* I wonder if emacs_close (emacs_open (pty, ...)) |
| 1329 | would work? */ | 1318 | would work? */ |
| 1330 | if (stdin >= 0) | 1319 | if (std_in >= 0) |
| 1331 | emacs_close (stdin); | 1320 | emacs_close (std_in); |
| 1332 | stdout = stdin = emacs_open (pty, O_RDWR, 0); | 1321 | std_out = std_in = emacs_open (pty, O_RDWR, 0); |
| 1333 | 1322 | ||
| 1334 | if (stdin < 0) | 1323 | if (std_in < 0) |
| 1335 | { | 1324 | { |
| 1336 | emacs_perror (pty); | 1325 | emacs_perror (pty); |
| 1337 | _exit (EXIT_CANCELED); | 1326 | _exit (EXIT_CANCELED); |
| @@ -1373,14 +1362,14 @@ emacs_spawn (pid_t *newpid, int stdin, int stdout, int stderr, | |||
| 1373 | unblock_child_signal (&oldset); | 1362 | unblock_child_signal (&oldset); |
| 1374 | 1363 | ||
| 1375 | if (pty_flag) | 1364 | if (pty_flag) |
| 1376 | child_setup_tty (stdout); | 1365 | child_setup_tty (std_out); |
| 1377 | 1366 | ||
| 1378 | if (stderr < 0) | 1367 | if (std_err < 0) |
| 1379 | stderr = stdout; | 1368 | std_err = std_out; |
| 1380 | #ifdef WINDOWSNT | 1369 | #ifdef WINDOWSNT |
| 1381 | pid = child_setup (stdin, stdout, stderr, argv, envp, cwd); | 1370 | pid = child_setup (std_in, std_out, std_err, argv, envp, cwd); |
| 1382 | #else /* not WINDOWSNT */ | 1371 | #else /* not WINDOWSNT */ |
| 1383 | child_setup (stdin, stdout, stderr, argv, envp, cwd); | 1372 | child_setup (std_in, std_out, std_err, argv, envp, cwd); |
| 1384 | #endif /* not WINDOWSNT */ | 1373 | #endif /* not WINDOWSNT */ |
| 1385 | } | 1374 | } |
| 1386 | 1375 | ||
| @@ -1531,7 +1520,7 @@ egetenv_internal (const char *var, ptrdiff_t len) | |||
| 1531 | objects. Don't call any Lisp code or the garbage collector while | 1520 | objects. Don't call any Lisp code or the garbage collector while |
| 1532 | the block is active. */ | 1521 | the block is active. */ |
| 1533 | 1522 | ||
| 1534 | char *const * | 1523 | char ** |
| 1535 | make_environment_block (Lisp_Object current_dir) | 1524 | make_environment_block (Lisp_Object current_dir) |
| 1536 | { | 1525 | { |
| 1537 | char **env; | 1526 | char **env; |
diff --git a/src/lisp.h b/src/lisp.h index c7188b171f8..501bcd14a6f 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4498,9 +4498,9 @@ extern void setup_process_coding_systems (Lisp_Object); | |||
| 4498 | # define CHILD_SETUP_ERROR_DESC "Doing vfork" | 4498 | # define CHILD_SETUP_ERROR_DESC "Doing vfork" |
| 4499 | #endif | 4499 | #endif |
| 4500 | 4500 | ||
| 4501 | extern int emacs_spawn (pid_t *, int, int, int, char *const *, | 4501 | extern int emacs_spawn (pid_t *, int, int, int, char **, char **, const char *, |
| 4502 | char *const *, const char *, const char *); | 4502 | const char *); |
| 4503 | extern char *const *make_environment_block (Lisp_Object); | 4503 | extern char **make_environment_block (Lisp_Object); |
| 4504 | extern void init_callproc_1 (void); | 4504 | extern void init_callproc_1 (void); |
| 4505 | extern void init_callproc (void); | 4505 | extern void init_callproc (void); |
| 4506 | extern void set_initial_environment (void); | 4506 | extern void set_initial_environment (void); |
diff --git a/src/process.c b/src/process.c index f3de9251b7a..98b575fc864 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -2127,7 +2127,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 2127 | 2127 | ||
| 2128 | /* This may signal an error. */ | 2128 | /* This may signal an error. */ |
| 2129 | setup_process_coding_systems (process); | 2129 | setup_process_coding_systems (process); |
| 2130 | char *const *env = make_environment_block (current_dir); | 2130 | char **env = make_environment_block (current_dir); |
| 2131 | 2131 | ||
| 2132 | pty_flag = p->pty_flag; | 2132 | pty_flag = p->pty_flag; |
| 2133 | eassert (pty_flag == ! NILP (lisp_pty_name)); | 2133 | eassert (pty_flag == ! NILP (lisp_pty_name)); |
| @@ -216,7 +216,7 @@ extern int sys_rename_replace (char const *, char const *, BOOL); | |||
| 216 | extern int pipe2 (int *, int); | 216 | extern int pipe2 (int *, int); |
| 217 | extern void register_aux_fd (int); | 217 | extern void register_aux_fd (int); |
| 218 | 218 | ||
| 219 | extern void set_process_dir (char *); | 219 | extern void set_process_dir (const char *); |
| 220 | extern int sys_spawnve (int, char *, char **, char **); | 220 | extern int sys_spawnve (int, char *, char **, char **); |
| 221 | extern void register_child (pid_t, int); | 221 | extern void register_child (pid_t, int); |
| 222 | 222 | ||
diff --git a/src/w32proc.c b/src/w32proc.c index 0cf82013065..66cdf7de461 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -3019,9 +3019,9 @@ reset_standard_handles (int in, int out, int err, HANDLE handles[3]) | |||
| 3019 | } | 3019 | } |
| 3020 | 3020 | ||
| 3021 | void | 3021 | void |
| 3022 | set_process_dir (char * dir) | 3022 | set_process_dir (const char * dir) |
| 3023 | { | 3023 | { |
| 3024 | process_dir = dir; | 3024 | process_dir = (char *) dir; |
| 3025 | } | 3025 | } |
| 3026 | 3026 | ||
| 3027 | /* To avoid problems with winsock implementations that work over dial-up | 3027 | /* To avoid problems with winsock implementations that work over dial-up |