summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/queue.c
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2008-12-31 09:55:25 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2008-12-31 09:55:25 +0000
commited262c0e338b0e0d86f17f8e7c5f85b8f2750e16 (patch)
tree81bdc6a8c929d9a1fdfafceddba9b1f81f3514ba /usr.sbin/smtpd/queue.c
parent7272e31a2e9fb958752a691eed2b9e357570e38b (diff)
if mkdir/mkdtemp fails, fatal if errno != ENOSPC; ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/queue.c')
-rw-r--r--usr.sbin/smtpd/queue.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c
index 4250cab3c3e..f8172a7c6fc 100644
--- a/usr.sbin/smtpd/queue.c
+++ b/usr.sbin/smtpd/queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue.c,v 1.38 2008/12/31 09:50:40 jacekm Exp $ */
+/* $OpenBSD: queue.c,v 1.39 2008/12/31 09:55:24 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -699,27 +699,28 @@ queue_create_incoming_layout(char *message_id)
PATH_INCOMING, time(NULL)))
fatalx("queue_create_incoming_layout: snprintf");
- if (mkdtemp(rootdir) == NULL)
- return 0;
+ if (mkdtemp(rootdir) == NULL) {
+ if (errno == ENOSPC)
+ return 0;
+ fatal("queue_create_incoming_layout: mkdtemp");
+ }
if (strlcpy(message_id, rootdir + strlen(PATH_INCOMING) + 1, MAXPATHLEN)
>= MAXPATHLEN)
- goto badroot;
+ fatalx("queue_create_incoming_layout: truncation");
- if (! bsnprintf(evpdir, MAXPATHLEN, "%s%s",
- rootdir, PATH_ENVELOPES))
- goto badroot;
+ if (! bsnprintf(evpdir, MAXPATHLEN, "%s%s", rootdir, PATH_ENVELOPES))
+ fatalx("queue_create_incoming_layout: snprintf");
- if (mkdir(evpdir, 0700) == -1)
- goto badroot;
+ if (mkdir(evpdir, 0700) == -1) {
+ if (errno == ENOSPC) {
+ rmdir(rootdir);
+ return 0;
+ }
+ fatal("queue_create_incoming_layout: mkdir");
+ }
return 1;
-
-badroot:
- if (rmdir(rootdir) == -1)
- fatal("queue_create_incoming_layout: rmdir");
-
- return 0;
}
void