summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2008-10-22 08:24:06 +0300
committerGuillem Jover <guillem@debian.org>2008-11-14 10:38:59 +0200
commit22f1d6726919f992c9949a5fe4d250f3d52b748a (patch)
tree697b2f1509e1811ae337ea1c2593cbbe66464f06 /lib
parentc8d175fd5578a171f91c9d921efac237325232fb (diff)
downloaddpkg-22f1d6726919f992c9949a5fe4d250f3d52b748a.tar.gz
Abort on unrecoverable fatal errors instead of continuing execution
The code handling onerr_abort is broken, and parts of the recovery code assumed the code would not reach them again as the program should have existed already. Closes: #497041, #499070
Diffstat (limited to 'lib')
-rw-r--r--lib/ehandle.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/ehandle.c b/lib/ehandle.c
index fbd69c283..64b030af2 100644
--- a/lib/ehandle.c
+++ b/lib/ehandle.c
@@ -75,7 +75,19 @@ static void run_error_handler(void) NONRETURNING;
static void
run_error_handler(void)
{
- longjmp(*econtext->jbufp, 1);
+ if (onerr_abort) {
+ /* We arrived here due to a fatal error from which we cannot recover,
+ * and trying to do so would most probably get us here again. That's
+ * why we will not try to do any error unwinding either. We'll just
+ * abort. Hopefully the user can fix the situation (out of disk, out
+ * of memory, etc).
+ */
+ fprintf(stderr, _("%s: unrecoverable fatal error, aborting:\n %s\n"),
+ thisname, errmsg);
+ exit(2);
+ } else {
+ longjmp(*econtext->jbufp, 1);
+ }
}
void push_error_handler(jmp_buf *jbufp,