# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../make/make-3.82-0009-long-command-line.patch # Copyright (C) 2012 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- From 23a3b958d8a80e601c1a0bf0770af6b854d00187 Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Mon, 22 Oct 2012 18:12:47 +0200 Subject: [PATCH] long command line ChangeLog: 2012-09-09 Paul Smith * job.c (construct_command_argv_internal): Keep the command line on the heap for very long lines. Fixes Savannah bug #36451. --- job.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/job.c b/job.c index 535a751..386d241 100644 --- a/job.c +++ b/job.c @@ -2865,8 +2865,8 @@ construct_command_argv_internal (char *line, char **restp, char *shell, return new_argv; } - new_line = alloca ((shell_len*2) + 1 + sflags_len + 1 - + (line_len*2) + 1); + new_line = xmalloc ((shell_len*2) + 1 + sflags_len + 1 + + (line_len*2) + 1); ap = new_line; /* Copy SHELL, escaping any characters special to the shell. If we don't escape them, construct_command_argv_internal will @@ -2933,8 +2933,11 @@ construct_command_argv_internal (char *line, char **restp, char *shell, *ap++ = *p; } if (ap == new_line + shell_len + sflags_len + 2) - /* Line was empty. */ - return 0; + { + /* Line was empty. */ + free (new_line); + return 0; + } *ap = '\0'; #ifdef WINDOWS32 @@ -3074,6 +3077,8 @@ construct_command_argv_internal (char *line, char **restp, char *shell, fatal (NILF, _("%s (line %d) Bad shell context (!unixy && !batch_mode_shell)\n"), __FILE__, __LINE__); #endif + + free (new_line); } #endif /* ! AMIGA */ -- 1.7.2.3