aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2014-09-07 13:31:18 -0700
committerPaul Eggert2014-09-07 13:31:18 -0700
commitd5e25ad17f871ed7837fcc5277efce762c112f2a (patch)
tree3433de7582ee1ea73de2bfeb75b09f4b61afd8a3 /src
parentbee407185922627a073b5fb57daae56043e689b0 (diff)
downloademacs-d5e25ad17f871ed7837fcc5277efce762c112f2a.tar.gz
emacs-d5e25ad17f871ed7837fcc5277efce762c112f2a.zip
* callproc.c (exec_failed) [DOS_NT]: Define a dummy.
All callers simplified. Add a comment about exec_failed, vfork, and alloca.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/callproc.c24
2 files changed, 18 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 777dcd81af2..88ab1eedca8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12014-09-07 Paul Eggert <eggert@cs.ucla.edu> 12014-09-07 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * callproc.c (exec_failed) [DOS_NT]: Define a dummy.
4 All callers simplified. Add a comment about exec_failed, vfork,
5 and alloca.
6
3 Adjust drag-and-drop fix when window is above top (Bug#18303). 7 Adjust drag-and-drop fix when window is above top (Bug#18303).
4 * xselect.c (x_fill_property_data): Don't let sign bit of negative 8 * xselect.c (x_fill_property_data): Don't let sign bit of negative
5 XCDR bleed into XCAR's encoded value. Improve checks for 9 XCDR bleed into XCAR's encoded value. Improve checks for
diff --git a/src/callproc.c b/src/callproc.c
index 271743021b6..c864471f504 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1154,6 +1154,9 @@ add_env (char **env, char **new_env, char *string)
1154#ifndef DOS_NT 1154#ifndef DOS_NT
1155 1155
1156/* 'exec' failed inside a child running NAME, with error number ERR. 1156/* 'exec' failed inside a child running NAME, with error number ERR.
1157 Possibly a vforked child needed to allocate a large vector on the
1158 stack; such a child cannot fall back on malloc because that might
1159 mess up the allocator's data structures in the parent.
1157 Report the error and exit the child. */ 1160 Report the error and exit the child. */
1158 1161
1159static _Noreturn void 1162static _Noreturn void
@@ -1168,6 +1171,17 @@ exec_failed (char const *name, int err)
1168 emacs_perror (name); 1171 emacs_perror (name);
1169 _exit (err == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE); 1172 _exit (err == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE);
1170} 1173}
1174
1175#else
1176
1177/* Do nothing. There is no need to fail, as DOS_NT platforms do not
1178 fork and exec, and handle alloca exhaustion in a different way. */
1179
1180static void
1181exec_failed (char const *name, int err)
1182{
1183}
1184
1171#endif 1185#endif
1172 1186
1173/* This is the last thing run in a newly forked inferior 1187/* This is the last thing run in a newly forked inferior
@@ -1213,13 +1227,8 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
1213 on that. */ 1227 on that. */
1214 pwd_var = xmalloc (i + 5); 1228 pwd_var = xmalloc (i + 5);
1215#else 1229#else
1216 /* WINDOWSNT doesn't define exec_failed, and doesn't need this
1217 test, since a directory name cannot be longer than 260
1218 characters, i.e. 260 * 4 = 1040 UTF-8 bytes. */
1219#ifndef WINDOWSNT
1220 if (MAX_ALLOCA - 5 < i) 1230 if (MAX_ALLOCA - 5 < i)
1221 exec_failed (new_argv[0], ENOMEM); 1231 exec_failed (new_argv[0], ENOMEM);
1222#endif
1223 pwd_var = alloca (i + 5); 1232 pwd_var = alloca (i + 5);
1224#endif 1233#endif
1225 temp = pwd_var + 4; 1234 temp = pwd_var + 4;
@@ -1286,10 +1295,8 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
1286 } 1295 }
1287 1296
1288 /* new_length + 2 to include PWD and terminating 0. */ 1297 /* new_length + 2 to include PWD and terminating 0. */
1289#ifndef WINDOWSNT
1290 if (MAX_ALLOCA / sizeof *env - 2 < new_length) 1298 if (MAX_ALLOCA / sizeof *env - 2 < new_length)
1291 exec_failed (new_argv[0], ENOMEM); 1299 exec_failed (new_argv[0], ENOMEM);
1292#endif
1293 env = new_env = alloca ((new_length + 2) * sizeof *env); 1300 env = new_env = alloca ((new_length + 2) * sizeof *env);
1294 /* If we have a PWD envvar, pass one down, 1301 /* If we have a PWD envvar, pass one down,
1295 but with corrected value. */ 1302 but with corrected value. */
@@ -1300,11 +1307,8 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
1300 { 1307 {
1301 char *vdata; 1308 char *vdata;
1302 1309
1303 /* WINDOWSNT doesn't have $DISPLAY. */
1304#ifndef WINDOWSNT
1305 if (MAX_ALLOCA - sizeof "DISPLAY=" < SBYTES (display)) 1310 if (MAX_ALLOCA - sizeof "DISPLAY=" < SBYTES (display))
1306 exec_failed (new_argv[0], ENOMEM); 1311 exec_failed (new_argv[0], ENOMEM);
1307#endif
1308 vdata = alloca (sizeof "DISPLAY=" + SBYTES (display)); 1312 vdata = alloca (sizeof "DISPLAY=" + SBYTES (display));
1309 strcpy (vdata, "DISPLAY="); 1313 strcpy (vdata, "DISPLAY=");
1310 strcat (vdata, SSDATA (display)); 1314 strcat (vdata, SSDATA (display));