← Commit list

0800e3af7

Denys Vlasenko
Denys Vlasenko
2009-09-24
FAILED Duration: 39s

Subject

ash: do not let EXIT trap to fire in `trap`

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 -1
@@ -4525,7 +4525,7 @@ clear_traps(void)
INT_OFF;
free(*tp);
*tp = NULL;
- if (tp != &trap[0])
+ if ((tp - trap) != 0)
setsignal(tp - trap);
INT_ON;
}
@@ -4596,6 +4596,8 @@ forkchild(struct job *jp, union node *n, int mode)
*
* Our solution: ONLY bare $(trap) or `trap` is special.
*/
+ free(trap[0]); /* Prevent EXIT trap from firing in `trap` */
+ trap[0] = NULL;
} else {
clear_traps();
}
@@ -13023,6 +13025,7 @@ exitshell(void)
if (p) {
trap[0] = NULL;
evalstring(p, 0);
+ free(p);
}
flush_stdout_stderr();
out: