diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2008-12-06 23:49:41 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2008-12-06 23:49:41 +0000 |
commit | 90ae19b3c16125ca46f9e9109ef1ed789fda1809 (patch) | |
tree | 229969d38ef9d1f24da1b815e804c6705db5e7b5 /usr.sbin | |
parent | d450e2bbf02cd16ea1aa51f561020a08ab4afccb (diff) |
Make queue_delete_incoming_message not fatal on ENOENT condition.
Also, fix function name in fatals.
ok gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/queue.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index 45d0c597c5b..5aff098f0fd 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.20 2008/12/06 14:30:51 jacekm Exp $ */ +/* $OpenBSD: queue.c,v 1.21 2008/12/06 23:49:40 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -813,30 +813,34 @@ queue_delete_incoming_message(char *message_id) } dirp = opendir(evpdir); - if (dirp == NULL) + if (dirp == NULL) { + if (errno == ENOENT) + goto delroot; fatal("queue_delete_incoming_message: opendir"); + } while ((dp = readdir(dirp)) != NULL) { if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) continue; spret = snprintf(evppath, MAXPATHLEN, "%s/%s", evpdir, dp->d_name); if (spret == -1 || spret >= MAXPATHLEN) - fatal("queue_create_incoming_message: snprintf"); + fatal("queue_delete_incoming_message: snprintf"); if (unlink(evppath) == -1) { if (errno != ENOENT) - fatal("queue_create_incoming_message: unlink"); + fatal("queue_delete_incoming_message: unlink"); } } closedir(dirp); if (rmdir(evpdir) == -1) if (errno != ENOENT) - fatal("queue_create_incoming_message: rmdir"); + fatal("queue_delete_incoming_message: rmdir"); +delroot: if (rmdir(rootdir) == -1) if (errno != ENOENT) - fatal("queue_create_incoming_message: rmdir"); + fatal("queue_delete_incoming_message: rmdir"); return; } |