diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-26 08:18:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-02-26 08:18:57 +0000 |
commit | 7f28246c4f0d3653895dab150883eae74ff5b4b5 (patch) | |
tree | 5215693d78f2192a0f2afe13a78ed51a16ebbf6a /libexec/spamlogd | |
parent | 3e2f267d7a634f03b8f16b9601f1d3042f227545 (diff) |
paranoia; beck ok
Diffstat (limited to 'libexec/spamlogd')
-rw-r--r-- | libexec/spamlogd/spamlogd.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libexec/spamlogd/spamlogd.c b/libexec/spamlogd/spamlogd.c index 23e6057e7b7..f93ed313d9e 100644 --- a/libexec/spamlogd/spamlogd.c +++ b/libexec/spamlogd/spamlogd.c @@ -1,3 +1,5 @@ +/* $OpenBSD: spamlogd.c,v 1.2 2004/02/26 08:18:56 deraadt Exp $ */ + /* * Copyright (c) 2004 Bob Beck. All rights reserved. * @@ -133,10 +135,12 @@ dbupdate(char *dbname, char *ip) } db->sync(db, 0); db->close(db); + db = NULL; return (0); bad: db->sync(db, 0); db->close(db); + db = NULL; return(-1); } @@ -144,7 +148,7 @@ static int usage(void) { fprintf(stderr, "usage: spamlogd [-i netif]\n"); - exit(-1); + exit(1); } char *targv[19] = { @@ -165,6 +169,8 @@ main(int argc, char **argv) while ((ch = getopt(argc, argv, "i:")) != -1) { switch (ch) { case 'i': + if (targv[17]) /* may only set once */ + usage(); targv[15] = "and"; targv[16] = "on"; targv[17] = optarg; @@ -197,6 +203,7 @@ main(int argc, char **argv) } /* parent */ + close(p[1]); f = fdopen(p[0], "r"); if (f == NULL) err(1, "fdopen"); |