summaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-07-29 14:05:27 +0000
committerDenis Vlasenko2007-07-29 14:05:27 +0000
commitdee82b6b78fab258584414557915e5169b051665 (patch)
treee09eaeb4832f990daedec526233b4a0562b33cf5 /shell/ash.c
parent1bab1de69866c38c3e9924d23f21a90623a0a6dc (diff)
downloadbusybox-dee82b6b78fab258584414557915e5169b051665.zip
busybox-dee82b6b78fab258584414557915e5169b051665.tar.gz
ash: comment non-obvious code part
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 5f4d176..d34f520 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11121,14 +11121,16 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
loop:
while ((fullname = padvance(&path, name)) != NULL) {
stunalloc(fullname);
+ /* NB: code below will still use fullname
+ * despite it being "unallocated" */
idx++;
if (pathopt) {
if (prefix(pathopt, "builtin")) {
if (bcmd)
goto builtin_success;
continue;
- } else if (!(act & DO_NOFUNC) &&
- prefix(pathopt, "func")) {
+ } else if (!(act & DO_NOFUNC)
+ && prefix(pathopt, "func")) {
/* handled below */
} else {
/* ignore unimplemented options */
@@ -11156,6 +11158,9 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
continue;
if (pathopt) { /* this is a %func directory */
stalloc(strlen(fullname) + 1);
+ /* NB: stalloc will return space pointed by fullname
+ * (because we don't have any intervening allocations
+ * between stunalloc above and this stalloc) */
readcmdfile(fullname);
cmdp = cmdlookup(name, 0);
if (cmdp == NULL || cmdp->cmdtype != CMDFUNCTION)