#define err(n, ...) _err(n, true, __FILE__, __LINE__, __VA_ARGS__)
#define errx(n, ...) _err(n, false, __FILE__, __LINE__, __VA_ARGS__)
+#define warn(...) _err(0, true, __FILE__, __LINE__, __VA_ARGS__)
+#define warnx(...) _err(0, false, __FILE__, __LINE__, __VA_ARGS__)
void
_err(int exitcode, bool want_strerror, char *fn, int lineno, char *format, ...)
return p->pw_name;
}
-static void
+static bool
get_transport(struct transport *t)
{
int status;
t->port = T_PORT;
if ((status = transport_setup(t, 0)) != EX_OK) {
- errx(status, "transport_setup");
+ warnx("non-fatal: transport_setup");
+ return false;
}
+
+ return true;
}
-static void
+static bool
get_message(char *fn, struct message *m)
{
int fd;
}
if ((status = message_read(fd, flags, m)) != EX_OK) {
- errx(status, "message_read");
+ warnx("non-fatal: message_read");
+ return false;
}
+
+ return true;
}
static bool
struct message m;
int status;
- get_transport(&t);
- get_message(message, &m);
+ if (!get_transport(&t)) {
+ return false;
+ }
+ if (!get_message(message, &m)) {
+ return false;
+ }
if ((status = message_filter(&t, logname(), flags, &m)) != EX_OK) {
- errx(status, "message_filter");
+ warnx("non-fatal: message_filter");
+ return false;
}
if (m.is_spam == EX_ISSPAM) {
return false;
}
- errx(m.is_spam, "message_filter");
- /*NOTREACHED*/
+ warnx("non-fatal: message_filter returned %d", m.is_spam);
return false;
}
/* 5 for spam/ and 1 for terminating null */
char *new = malloc(len + 5 + 1);
+ /* Nothing to do about a malloc failure but dump core. */
strcpy(errfn, "err");
strcat(errfn, tmp + 3);