Skip to content

Commit

Permalink
WIP make fatals abort (based on capstone commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliefm committed Jun 26, 2024
1 parent 90d2bb5 commit be0699c
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 2 deletions.
2 changes: 2 additions & 0 deletions imap/calalarmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ EXPORTED void fatal(const char *msg, int err)

cyrus_done();

if (err != EX_PROTOCOL && config_fatals_abort) abort();

exit(err);
}

Expand Down
3 changes: 3 additions & 0 deletions imap/httpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,9 @@ EXPORTED void fatal(const char* s, int code)
}

syslog(LOG_ERR, "%s%s", fatal, s);

if (code != EX_PROTOCOL && config_fatals_abort) abort();

shut_down(code);
}

Expand Down
2 changes: 2 additions & 0 deletions imap/idled.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ EXPORTED void fatal(const char *msg, int err)

cyrus_done();

if (err != EX_PROTOCOL && config_fatals_abort) abort();

exit(err);
}

Expand Down
3 changes: 3 additions & 0 deletions imap/imapd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,9 @@ EXPORTED void fatal(const char *s, int code)
}

syslog(LOG_ERR, "Fatal error: %s", s);

if (code != EX_PROTOCOL && config_fatals_abort) abort();

shut_down(code);
}

Expand Down
4 changes: 2 additions & 2 deletions imap/lmtpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,10 +1034,10 @@ EXPORTED void fatal(const char* s, int code)

syslog(LOG_ERR, "FATAL: %s", s);

if (code != EX_PROTOCOL && config_fatals_abort) abort();

/* shouldn't return */
shut_down(code);

exit(code);
}

/*
Expand Down
3 changes: 3 additions & 0 deletions imap/pop3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,9 @@ EXPORTED void fatal(const char* s, int code)
prot_flush(popd_out);
}
syslog(LOG_ERR, "Fatal error: %s", s);

if (code != EX_PROTOCOL && config_fatals_abort) abort();

shut_down(code);
}

Expand Down
2 changes: 2 additions & 0 deletions imap/promstatsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ EXPORTED void fatal(const char *msg, int err)
syslog(LOG_CRIT, "%s", msg);
syslog(LOG_NOTICE, "exiting");

if (err != EX_PROTOCOL && config_fatals_abort) abort();

shut_down(err);
}

Expand Down
3 changes: 3 additions & 0 deletions imap/sync_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ EXPORTED void fatal(const char *s, int code)
{
fprintf(stderr, "Fatal error: %s\n", s);
syslog(LOG_ERR, "Fatal error: %s", s);

if (code != EX_PROTOCOL && config_fatals_abort) abort();

exit(code);
}

Expand Down
1 change: 1 addition & 0 deletions imap/sync_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ EXPORTED void fatal(const char* s, int code)
prot_flush(sync_out);
}
syslog(LOG_ERR, "Fatal error: %s", s);
if (code != EX_PROTOCOL && config_fatals_abort) abort();
shut_down(code);
}

Expand Down
3 changes: 3 additions & 0 deletions lib/assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@
#include "xmalloc.h"
#include "assert.h"

extern int config_fatals_abort;

EXPORTED void
assertionfailed(const char *file, int line, const char *expr)
{
char buf[1024];

snprintf(buf, sizeof(buf), "Internal error: assertion failed: %s: %d%s%s",
file, line, expr ? ": " : "", expr ? expr : "");
if (config_fatals_abort) abort();
fatal(buf, EX_SOFTWARE);
}
1 change: 1 addition & 0 deletions master/master.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ EXPORTED void fatal(const char *msg, int code)
{
syslog(LOG_CRIT, "%s", msg);
syslog(LOG_NOTICE, "exiting");
if (code != EX_PROTOCOL && config_fatals_abort) abort();
exit(code);
}

Expand Down
3 changes: 3 additions & 0 deletions sieve/sieved.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include <unistd.h>
#include <netinet/in.h>
#include <inttypes.h>
#include <sysexits.h>

#include <string.h>

Expand All @@ -75,6 +76,8 @@ EXPORTED void fatal(const char *s, int code)
{
fprintf(stderr, "Fatal error: %s (%d)\r\n", s, code);

if (code != EX_PROTOCOL && config_fatals_abort) abort();

exit(code);
}

Expand Down

0 comments on commit be0699c

Please sign in to comment.