From 58c0eca145bdee791d51e7c3b76125cebc546a3f Mon Sep 17 00:00:00 2001 From: Jacek Masiulaniec Date: Wed, 17 Dec 2008 23:09:24 +0000 Subject: Warn if empty map is being created; this catches at least usage error such as "makemap foo.db". ok gilles@ --- usr.sbin/smtpd/makemap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'usr.sbin') 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 @@ -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); } -- cgit v1.2.3