diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/README | 3 | ||||
-rw-r--r-- | shell/ash.c | 4 | ||||
-rw-r--r-- | shell/hush.c | 16 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/read.right | 4 | ||||
-rwxr-xr-x | shell/hush_test/hush-misc/read.tests | 4 |
5 files changed, 16 insertions, 15 deletions
diff --git a/shell/README b/shell/README index a09353d6c..b86f96cf4 100644 --- a/shell/README +++ b/shell/README @@ -1,5 +1,8 @@ Various bits of what is known about busybox shells, in no particular order. +2007-06-13 +hush: exec <"$1" doesn't do parameter subst + 2007-05-24 hush: environment-related memory leak plugged, with net code size decrease. diff --git a/shell/ash.c b/shell/ash.c index ae078e609..173beb195 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -11567,8 +11567,8 @@ readcmd(int argc, char **argv) #endif #if ENABLE_ASH_READ_TIMEOUT if (ts.tv_sec || ts.tv_usec) { - FD_ZERO (&set); - FD_SET (0, &set); + FD_ZERO(&set); + FD_SET(0, &set); i = select(FD_SETSIZE, &set, NULL, NULL, &ts); if (!i) { diff --git a/shell/hush.c b/shell/hush.c index 40bcafdd9..e6fa3d9a5 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -942,21 +942,11 @@ static int builtin_pwd(char **argv ATTRIBUTE_UNUSED) /* built-in 'read VAR' handler */ static int builtin_read(char **argv) { - char string[BUFSIZ]; - char *p; + char *string; const char *name = argv[1] ? argv[1] : "REPLY"; - int name_len = strlen(name); - if (name_len >= sizeof(string) - 2) - return EXIT_FAILURE; - strcpy(string, name); - p = string + name_len; - *p++ = '='; - *p = '\0'; /* In case stdin has only EOF */ - /* read string. name_len+1 chars are already used by 'name=' */ - fgets(p, sizeof(string) - 1 - name_len, stdin); - chomp(p); - return set_local_var(xstrdup(string), 0); + string = xmalloc_reads(STDIN_FILENO, xasprintf("%s=", name)); + return set_local_var(string, 0); } /* built-in 'set [VAR=value]' handler */ diff --git a/shell/hush_test/hush-misc/read.right b/shell/hush_test/hush-misc/read.right new file mode 100644 index 000000000..0e50e2a23 --- /dev/null +++ b/shell/hush_test/hush-misc/read.right @@ -0,0 +1,4 @@ +read +cat +echo "REPLY=$REPLY" +REPLY=exec <read.tests diff --git a/shell/hush_test/hush-misc/read.tests b/shell/hush_test/hush-misc/read.tests new file mode 100755 index 000000000..ff1acbde1 --- /dev/null +++ b/shell/hush_test/hush-misc/read.tests @@ -0,0 +1,4 @@ +exec <read.tests +read +cat +echo "REPLY=$REPLY" |