diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2008-12-17 23:09:24 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2008-12-17 23:09:24 +0000 |
commit | 58c0eca145bdee791d51e7c3b76125cebc546a3f (patch) | |
tree | 41ebfd69acf2dcc3fb7cde004d7661f811bf778b /usr.sbin | |
parent | a1ec3abf9b11ef5ffcc78d91109fb89fe3c8eb05 (diff) |
Warn if empty map is being created; this catches at least usage
error such as "makemap foo.db".
ok gilles@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/makemap.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c index d8870293d9e..9772f545386 100644 --- a/usr.sbin/smtpd/makemap.c +++ b/usr.sbin/smtpd/makemap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemap.c,v 1.3 2008/12/17 22:59:36 jacekm Exp $ */ +/* $OpenBSD: makemap.c,v 1.4 2008/12/17 23:09:23 jacekm Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -47,6 +47,7 @@ int parse_entry(char *, size_t, size_t); DB *db; char *source; +int dbputs; enum program { P_MAKEMAP, @@ -112,6 +113,9 @@ main(int argc, char *argv[]) goto bad; } + if (dbputs == 0) + warnx("warning: empty map created: %s", dest); + return 0; bad: unlink(dbname); @@ -239,6 +243,7 @@ parse_entry(char *line, size_t len, size_t lineno) return 0; } + dbputs++; free(p); } |