When using wordexp, only try to use the expand command

when something actually got expanded.  Skip it otherwise.
 -Erik
This commit is contained in:
Eric Andersen 2001-03-10 07:12:12 +00:00
parent 78f57460f2
commit 1365bb7861
3 changed files with 42 additions and 36 deletions

2
lash.c
View File

@ -941,6 +941,7 @@ static int expand_arguments(char *command)
return FALSE; return FALSE;
} }
if (expand_result.we_wordc > 0) {
/* Convert from char** (one word per string) to a simple char*, /* Convert from char** (one word per string) to a simple char*,
* but don't overflow command which is BUFSIZ in length */ * but don't overflow command which is BUFSIZ in length */
*command = '\0'; *command = '\0';
@ -955,6 +956,7 @@ static int expand_arguments(char *command)
total_length+=length; total_length+=length;
} }
wordfree (&expand_result); wordfree (&expand_result);
}
#else #else
/* Ok. They don't have a recent glibc and they don't have uClibc. Chances /* Ok. They don't have a recent glibc and they don't have uClibc. Chances

2
sh.c
View File

@ -941,6 +941,7 @@ static int expand_arguments(char *command)
return FALSE; return FALSE;
} }
if (expand_result.we_wordc > 0) {
/* Convert from char** (one word per string) to a simple char*, /* Convert from char** (one word per string) to a simple char*,
* but don't overflow command which is BUFSIZ in length */ * but don't overflow command which is BUFSIZ in length */
*command = '\0'; *command = '\0';
@ -955,6 +956,7 @@ static int expand_arguments(char *command)
total_length+=length; total_length+=length;
} }
wordfree (&expand_result); wordfree (&expand_result);
}
#else #else
/* Ok. They don't have a recent glibc and they don't have uClibc. Chances /* Ok. They don't have a recent glibc and they don't have uClibc. Chances

View File

@ -941,6 +941,7 @@ static int expand_arguments(char *command)
return FALSE; return FALSE;
} }
if (expand_result.we_wordc > 0) {
/* Convert from char** (one word per string) to a simple char*, /* Convert from char** (one word per string) to a simple char*,
* but don't overflow command which is BUFSIZ in length */ * but don't overflow command which is BUFSIZ in length */
*command = '\0'; *command = '\0';
@ -955,6 +956,7 @@ static int expand_arguments(char *command)
total_length+=length; total_length+=length;
} }
wordfree (&expand_result); wordfree (&expand_result);
}
#else #else
/* Ok. They don't have a recent glibc and they don't have uClibc. Chances /* Ok. They don't have a recent glibc and they don't have uClibc. Chances