← Commit list

7aec86820

Denys Vlasenko
Denys Vlasenko
2016-10-25
SUCCESS Duration: 252s

Subject

ash: [EVAL] Let funcnode refer to a function definition, not its first command

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/ash.c+4 -4
@@ -8449,14 +8449,14 @@ copyfunc(union node *n)
* Define a shell function.
*/
static void
-defun(char *name, union node *func)
+defun(union node *func)
{
struct cmdentry entry;
INT_OFF;
entry.cmdtype = CMDFUNCTION;
entry.u.func = copyfunc(func);
- addcmdentry(name, &entry);
+ addcmdentry(func->narg.text, &entry);
INT_ON;
}
@@ -8654,7 +8654,7 @@ evaltree(union node *n, int flags)
status = 0;
goto setstatus;
case NDEFUN:
- defun(n->narg.text, n->narg.next);
+ defun(n);
/* Not necessary. To test it:
* "false; f() { qwerty; }; echo $?" should print 0.
*/
@@ -9079,7 +9079,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
shellparam.optind = 1;
shellparam.optoff = -1;
#endif
- evaltree(&func->n, flags & EV_TESTED);
+ evaltree(func->n.narg.next, flags & EV_TESTED);
funcdone:
INT_OFF;
funcnest--;