summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2016-02-10 09:23:54 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2016-02-10 09:23:54 +0000
commit060608b110c5311fe44f770dd4e38b7f13a8a081 (patch)
tree613f2ce5a4331395b97cc7cdb8f69e1edaf34ffb
parent7150eb3de381ea36cb360b8972c9ef81b143c268 (diff)
when creating a db map, we use a temporary file to work on and atomically
move to destination when done. this causes dbopen() to be called with an empty file which happens to... not work with other db libraries. adding O_TRUNC is noop for us, fixes the issue for other libraries and lets us reduce delta between us and portable. ok sunil@, ok eric@
-rw-r--r--usr.sbin/smtpd/makemap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c
index da0718c5590..c1c39d20ad2 100644
--- a/usr.sbin/smtpd/makemap.c
+++ b/usr.sbin/smtpd/makemap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: makemap.c,v 1.61 2015/12/28 22:08:30 jung Exp $ */
+/* $OpenBSD: makemap.c,v 1.62 2016/02/10 09:23:53 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -191,7 +191,7 @@ makemap(int argc, char *argv[])
if ((fd = mkstemp(dbname)) == -1)
err(1, "mkstemp");
- db = dbopen(dbname, O_RDWR, 0644, dbtype, NULL);
+ db = dbopen(dbname, O_TRUNC|O_RDWR, 0644, dbtype, NULL);
if (db == NULL) {
warn("dbopen: %s", dbname);
goto bad;