diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-02-17 23:50:59 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2009-02-17 23:50:59 +0000 |
commit | c0778599bbf5c88cafdefc29ed49945586e65468 (patch) | |
tree | 38fdf66b4c2a645cc4974de4c6855f061be21b76 /usr.sbin | |
parent | cc9cb232a359a229eb9263de9f63c1af1ff80bc2 (diff) |
- flock input file while the database is being built
- make newaliases finish with short summary
ok gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/makemap.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c index eb76ad6fe73..0d9a1c232a2 100644 --- a/usr.sbin/smtpd/makemap.c +++ b/usr.sbin/smtpd/makemap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemap.c,v 1.9 2009/02/17 23:43:57 jacekm Exp $ */ +/* $OpenBSD: makemap.c,v 1.10 2009/02/17 23:50:58 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -162,7 +162,9 @@ main(int argc, char *argv[]) goto bad; } - if (dbputs == 0) + if (mode == P_NEWALIASES) + printf("%s: %d aliases\n", source, dbputs); + else if (dbputs == 0) warnx("warning: empty map created: %s", oflag); return 0; @@ -186,6 +188,15 @@ parse_map(char *filename) return 0; } + if (flock(fileno(fp), LOCK_SH|LOCK_NB) == -1) { + if (errno == EWOULDBLOCK) + warnx("%s is locked", filename); + else + warn("%s: flock", filename); + fclose(fp); + return 0; + } + while ((line = fparseln(fp, &len, &lineno, delim, 0)) != NULL) { if (! parse_entry(line, len, lineno)) { free(line); |