emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117837: * callproc.c (exec_failed) [DOS_NT]: Define


From: Paul Eggert
Subject: [Emacs-diffs] trunk r117837: * callproc.c (exec_failed) [DOS_NT]: Define a dummy.
Date: Sun, 07 Sep 2014 20:31:37 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117837
revision-id: address@hidden
parent: address@hidden
author: Paul Eggert  <address@hidden>
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2014-09-07 13:31:18 -0700
message:
  * callproc.c (exec_failed) [DOS_NT]: Define a dummy.
  
  All callers simplified.  Add a comment about exec_failed, vfork,
  and alloca.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/callproc.c                 callproc.c-20091113204419-o5vbwnq5f7feedwu-248
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-09-07 19:47:28 +0000
+++ b/src/ChangeLog     2014-09-07 20:31:18 +0000
@@ -1,5 +1,9 @@
 2014-09-07  Paul Eggert  <address@hidden>
 
+       * callproc.c (exec_failed) [DOS_NT]: Define a dummy.
+       All callers simplified.  Add a comment about exec_failed, vfork,
+       and alloca.
+
        Adjust drag-and-drop fix when window is above top (Bug#18303).
        * xselect.c (x_fill_property_data): Don't let sign bit of negative
        XCDR bleed into XCAR's encoded value.  Improve checks for

=== modified file 'src/callproc.c'
--- a/src/callproc.c    2014-09-07 17:04:19 +0000
+++ b/src/callproc.c    2014-09-07 20:31:18 +0000
@@ -1154,6 +1154,9 @@
 #ifndef DOS_NT
 
 /* 'exec' failed inside a child running NAME, with error number ERR.
+   Possibly a vforked child needed to allocate a large vector on the
+   stack; such a child cannot fall back on malloc because that might
+   mess up the allocator's data structures in the parent.
    Report the error and exit the child.  */
 
 static _Noreturn void
@@ -1168,6 +1171,17 @@
   emacs_perror (name);
   _exit (err == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE);
 }
+
+#else
+
+/* Do nothing.  There is no need to fail, as DOS_NT platforms do not
+   fork and exec, and handle alloca exhaustion in a different way.  */
+
+static void
+exec_failed (char const *name, int err)
+{
+}
+
 #endif
 
 /* This is the last thing run in a newly forked inferior
@@ -1213,13 +1227,8 @@
        on that.  */
     pwd_var = xmalloc (i + 5);
 #else
-    /* WINDOWSNT doesn't define exec_failed, and doesn't need this
-       test, since a directory name cannot be longer than 260
-       characters, i.e. 260 * 4 = 1040 UTF-8 bytes.  */
-#ifndef WINDOWSNT
     if (MAX_ALLOCA - 5 < i)
       exec_failed (new_argv[0], ENOMEM);
-#endif
     pwd_var = alloca (i + 5);
 #endif
     temp = pwd_var + 4;
@@ -1286,10 +1295,8 @@
       }
 
     /* new_length + 2 to include PWD and terminating 0.  */
-#ifndef WINDOWSNT
     if (MAX_ALLOCA / sizeof *env - 2 < new_length)
       exec_failed (new_argv[0], ENOMEM);
-#endif
     env = new_env = alloca ((new_length + 2) * sizeof *env);
     /* If we have a PWD envvar, pass one down,
        but with corrected value.  */
@@ -1300,11 +1307,8 @@
       {
        char *vdata;
 
-       /* WINDOWSNT doesn't have $DISPLAY.  */
-#ifndef WINDOWSNT
        if (MAX_ALLOCA - sizeof "DISPLAY=" < SBYTES (display))
          exec_failed (new_argv[0], ENOMEM);
-#endif
        vdata = alloca (sizeof "DISPLAY=" + SBYTES (display));
        strcpy (vdata, "DISPLAY=");
        strcat (vdata, SSDATA (display));


reply via email to

[Prev in Thread] Current Thread [Next in Thread]