diff options
-rw-r--r-- | usr.sbin/smtpd/queue_fs.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.sbin/smtpd/queue_fs.c b/usr.sbin/smtpd/queue_fs.c index 5530312d726..d00b1208d3b 100644 --- a/usr.sbin/smtpd/queue_fs.c +++ b/usr.sbin/smtpd/queue_fs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_fs.c,v 1.2 2013/10/26 12:27:59 eric Exp $ */ +/* $OpenBSD: queue_fs.c,v 1.3 2013/11/06 10:07:29 eric Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@poolp.org> @@ -72,6 +72,8 @@ static void fsqueue_qwalk_close(void *); struct tree evpcount; static struct timespec startup; +#define REF (int*)0xf00 + static int queue_fs_message_create(uint32_t *msgid) { @@ -235,9 +237,8 @@ queue_fs_envelope_create(uint32_t msgid, const char *buf, size_t len, uint64_t *evpid) { char path[SMTPD_MAXPATHLEN]; - int queued = 0, i, r = 0; + int queued = 0, i, r = 0, *n; struct stat sb; - uintptr_t *n; if (msgid == 0) { log_warnx("warn: queue-fs: msgid=0, evpid=%016"PRIx64, *evpid); @@ -267,7 +268,7 @@ done: if (r) { n = tree_pop(&evpcount, msgid); if (n == NULL) - n = 0; + n = REF; n += 1; tree_xset(&evpcount, msgid, n); } @@ -319,7 +320,7 @@ queue_fs_envelope_delete(uint64_t evpid) { char pathname[SMTPD_MAXPATHLEN]; uint32_t msgid; - uintptr_t *n; + int *n; fsqueue_envelope_path(evpid, pathname, sizeof(pathname)); if (unlink(pathname) == -1) @@ -330,7 +331,7 @@ queue_fs_envelope_delete(uint64_t evpid) n = tree_pop(&evpcount, msgid); n -= 1; - if ((uintptr_t)n == 0) + if (n - REF == 0) queue_fs_message_delete(msgid); else tree_xset(&evpcount, msgid, n); @@ -343,8 +344,7 @@ queue_fs_envelope_walk(uint64_t *evpid, char *buf, size_t len) { static int done = 0; static void *hdl = NULL; - uintptr_t *n; - int r; + int r, *n; uint32_t msgid; if (done) @@ -359,6 +359,8 @@ queue_fs_envelope_walk(uint64_t *evpid, char *buf, size_t len) if (r) { msgid = evpid_to_msgid(*evpid); n = tree_pop(&evpcount, msgid); + if (n == NULL) + n = REF; n += 1; tree_xset(&evpcount, msgid, n); } |