aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Whitley <markw@lineo.com>2001-03-14 17:26:37 +0000
committerMark Whitley <markw@lineo.com>2001-03-14 17:26:37 +0000
commit44a991470955ec3018ba8f40cc3be7b864dc8cce (patch)
tree6bfa26b060af732168af8c8eb0e653dbada3f196
parent2892c35bdbfa05e786c087b183d31dafcd6abace (diff)
downloadbusybox-44a991470955ec3018ba8f40cc3be7b864dc8cce.tar.gz
Applied patch from Larry Doolittle to fix '>\na\n' bug. Should close bug #1132
-rw-r--r--lash.c11
-rw-r--r--sh.c11
-rw-r--r--shell/lash.c11
3 files changed, 24 insertions, 9 deletions
diff --git a/lash.c b/lash.c
index 3c52e2a28..8edb78369 100644
--- a/lash.c
+++ b/lash.c
@@ -669,17 +669,22 @@ static void close_all()
static void free_job(struct job *cmd)
{
int i;
+ struct jobset *keep;
for (i = 0; i < cmd->num_progs; i++) {
free(cmd->progs[i].argv);
if (cmd->progs[i].redirects)
free(cmd->progs[i].redirects);
}
- free(cmd->progs);
+ if (cmd->progs)
+ free(cmd->progs);
if (cmd->text)
free(cmd->text);
- free(cmd->cmdbuf);
+ if (cmd->cmdbuf)
+ free(cmd->cmdbuf);
+ keep = cmd->job_list;
memset(cmd, 0, sizeof(struct job));
+ cmd->job_list = keep;
}
/* remove a job from the job_list */
@@ -1296,7 +1301,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
chptr++;
if (!*chptr) {
- error_msg("file name expected after %c", *src);
+ error_msg("file name expected after %c", *(src-1));
free_job(job);
job->num_progs=0;
return 1;
diff --git a/sh.c b/sh.c
index 3c52e2a28..8edb78369 100644
--- a/sh.c
+++ b/sh.c
@@ -669,17 +669,22 @@ static void close_all()
static void free_job(struct job *cmd)
{
int i;
+ struct jobset *keep;
for (i = 0; i < cmd->num_progs; i++) {
free(cmd->progs[i].argv);
if (cmd->progs[i].redirects)
free(cmd->progs[i].redirects);
}
- free(cmd->progs);
+ if (cmd->progs)
+ free(cmd->progs);
if (cmd->text)
free(cmd->text);
- free(cmd->cmdbuf);
+ if (cmd->cmdbuf)
+ free(cmd->cmdbuf);
+ keep = cmd->job_list;
memset(cmd, 0, sizeof(struct job));
+ cmd->job_list = keep;
}
/* remove a job from the job_list */
@@ -1296,7 +1301,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
chptr++;
if (!*chptr) {
- error_msg("file name expected after %c", *src);
+ error_msg("file name expected after %c", *(src-1));
free_job(job);
job->num_progs=0;
return 1;
diff --git a/shell/lash.c b/shell/lash.c
index 3c52e2a28..8edb78369 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -669,17 +669,22 @@ static void close_all()
static void free_job(struct job *cmd)
{
int i;
+ struct jobset *keep;
for (i = 0; i < cmd->num_progs; i++) {
free(cmd->progs[i].argv);
if (cmd->progs[i].redirects)
free(cmd->progs[i].redirects);
}
- free(cmd->progs);
+ if (cmd->progs)
+ free(cmd->progs);
if (cmd->text)
free(cmd->text);
- free(cmd->cmdbuf);
+ if (cmd->cmdbuf)
+ free(cmd->cmdbuf);
+ keep = cmd->job_list;
memset(cmd, 0, sizeof(struct job));
+ cmd->job_list = keep;
}
/* remove a job from the job_list */
@@ -1296,7 +1301,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
chptr++;
if (!*chptr) {
- error_msg("file name expected after %c", *src);
+ error_msg("file name expected after %c", *(src-1));
free_job(job);
job->num_progs=0;
return 1;