diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-02-22 11:55:18 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-02-22 11:55:18 +0000 |
commit | d4de179026e1484a6cb85e845da9670b3e87d8f9 (patch) | |
tree | 2e6bf6d820ea2e2159a3b6699be3405c0f6369c4 | |
parent | 84aafbcbd7d4bfbe59924ecc5b635ddee9b7d49e (diff) |
simplify qwalk() error handling; ok gilles@
-rw-r--r-- | usr.sbin/smtpd/queue_shared.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/usr.sbin/smtpd/queue_shared.c b/usr.sbin/smtpd/queue_shared.c index 17d37c53b61..0875b768bfe 100644 --- a/usr.sbin/smtpd/queue_shared.c +++ b/usr.sbin/smtpd/queue_shared.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue_shared.c,v 1.10 2009/02/22 11:44:29 form Exp $ */ +/* $OpenBSD: queue_shared.c,v 1.11 2009/02/22 11:55:17 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -47,6 +47,7 @@ struct qwalk { int (*filefn)(struct qwalk *, char *); int bucket; int level; + int strict; }; int walk_simple(struct qwalk *, char *); @@ -535,8 +536,12 @@ qwalk_new(char *path) strlcpy(q->path, path, sizeof(q->path)); q->level = 0; + q->strict = 0; q->filefn = walk_simple; + if (smtpd_process == PROC_QUEUE || smtpd_process == PROC_RUNNER) + q->strict = 1; + if (strcmp(path, PATH_QUEUE) == 0) q->filefn = walk_queue; @@ -584,14 +589,7 @@ recurse: q->level++; q->dirs[q->level] = opendir(q->path); if (q->dirs[q->level] == NULL) { - /* - * ENOENT is unacceptable in queue/runner. It's perfectly fine - * for others (eg. smtpctl). - */ - if (errno == ENOENT) { - if (smtpd_process == PROC_QUEUE || - smtpd_process == PROC_RUNNER) - fatal("qwalk: opendir"); + if (errno == ENOENT && !q->strict) { q->level--; goto again; } |