From 060608b110c5311fe44f770dd4e38b7f13a8a081 Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Wed, 10 Feb 2016 09:23:54 +0000 Subject: 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@ --- usr.sbin/smtpd/makemap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.sbin') 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 @@ -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; -- cgit v1.2.3