it isn't defined, define it to EX_TEMPFAIL. Change all references to
EX_TEMPFAIL to MDELIVER_EXITCODE.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <time.h>
#include <unistd.h>
+#ifndef MDELIVER_EXITCODE
+#include <sysexits.h>
+#define MDELIVER_EXITCODE EX_TEMPFAIL
+#endif
+
#if !defined(HOST_NAME_MAX)
#if defined MAXHOSTNAMELEN
#define HOST_NAME_MAX MAXHOSTNAMELEN
#if !defined(HOST_NAME_MAX)
#if defined MAXHOSTNAMELEN
#define HOST_NAME_MAX MAXHOSTNAMELEN
pid = getpid();
if (gethostname(host, sizeof(host)) != 0) {
pid = getpid();
if (gethostname(host, sizeof(host)) != 0) {
- err(EX_TEMPFAIL, "Failed gethostname");
+ err(MDELIVER_EXITCODE, "Failed gethostname");
}
for (try = 0; ; try++) {
}
for (try = 0; ; try++) {
- errx(EX_TEMPFAIL, "Attempted filename exists.");
+ errx(MDELIVER_EXITCODE, "Attempted filename exists.");
r = read(STDIN_FILENO, buf, 5);
if (r != 5) {
unlink(fn);
r = read(STDIN_FILENO, buf, 5);
if (r != 5) {
unlink(fn);
- err(EX_TEMPFAIL, "Failed read from stdin");
+ err(MDELIVER_EXITCODE, "Failed read from stdin");
}
if (strncmp(buf, "From ", 5) == 0) {
}
if (strncmp(buf, "From ", 5) == 0) {
if (r == -1) {
unlink(fn);
if (r == -1) {
unlink(fn);
- err(EX_TEMPFAIL, "Failed read from stdin");
+ err(MDELIVER_EXITCODE, "Failed read from stdin");
}
} else {
if (full_write(fd, buf, r) != r) {
unlink(fn);
}
} else {
if (full_write(fd, buf, r) != r) {
unlink(fn);
- err(EX_TEMPFAIL, "Failed write(%s)", fn);
+ err(MDELIVER_EXITCODE, "Failed write(%s)", fn);
|| (r == -1 && errno == EINTR)) {
if (full_write(fd, buf, r) != r) {
unlink(fn);
|| (r == -1 && errno == EINTR)) {
if (full_write(fd, buf, r) != r) {
unlink(fn);
- err(EX_TEMPFAIL, "Failed write(%s)", fn);
+ err(MDELIVER_EXITCODE, "Failed write(%s)", fn);
}
}
if (r == -1) {
unlink(fn);
}
}
if (r == -1) {
unlink(fn);
- err(EX_TEMPFAIL, "Failed read from stdin");
+ err(MDELIVER_EXITCODE, "Failed read from stdin");
}
if (fsync(fd) < 0) {
unlink(fn);
}
if (fsync(fd) < 0) {
unlink(fn);
- err(EX_TEMPFAIL, "Failed fsync(%s)", fn);
+ err(MDELIVER_EXITCODE, "Failed fsync(%s)", fn);
}
if (close(fd) < 0) {
unlink(fn);
}
if (close(fd) < 0) {
unlink(fn);
- err(EX_TEMPFAIL, "Failed close(%s)", fn);
+ err(MDELIVER_EXITCODE, "Failed close(%s)", fn);
* evil) space optimization. */
if (chdir(maildir) != 0) {
* evil) space optimization. */
if (chdir(maildir) != 0) {
- err(EX_TEMPFAIL, "Failed chdir(%s)", maildir);
+ err(MDELIVER_EXITCODE, "Failed chdir(%s)", maildir);
}
get_filename(fn);
fd = open(fn, O_WRONLY | O_EXCL | O_CREAT, 0600);
if (fd < 0) {
}
get_filename(fn);
fd = open(fn, O_WRONLY | O_EXCL | O_CREAT, 0600);
if (fd < 0) {
- err(EX_TEMPFAIL, "Failed open(%s)", fn);
+ err(MDELIVER_EXITCODE, "Failed open(%s)", fn);
}
/* From this point, we have a tmp file, so if someting fails we
}
/* From this point, we have a tmp file, so if someting fails we
if (rename(fn, newfn) != 0) {
unlink(fn);
if (rename(fn, newfn) != 0) {
unlink(fn);
- err(EX_TEMPFAIL, "Failed rename(%s, new)", fn);
+ err(MDELIVER_EXITCODE, "Failed rename(%s, new)", fn);
}
if (!(home = getenv("HOME"))) {
}
if (!(home = getenv("HOME"))) {
- err(EX_TEMPFAIL, "Failed getenv(HOME)");
+ err(MDELIVER_EXITCODE, "Failed getenv(HOME)");
}
if (chdir(home) != 0) {
}
if (chdir(home) != 0) {
- err(EX_TEMPFAIL, "Failed chdir(HOME)");
+ err(MDELIVER_EXITCODE, "Failed chdir(HOME)");
}
deliver("Maildir", newfn);
}
deliver("Maildir", newfn);