diff options
author | mbr <mbr@FreeBSD.org> | 2003-09-02 15:27:38 +0000 |
---|---|---|
committer | mbr <mbr@FreeBSD.org> | 2003-09-02 15:27:38 +0000 |
commit | 7d0df748b4c59651751f156e408f856a02073b69 (patch) | |
tree | 4674a9f108ae4334ed6a61634f703f67f6533f4d /contrib/amd/mk-amd-map | |
parent | 532be24b7ef077cdfe0129dee60ab1f934c24181 (diff) | |
download | FreeBSD-src-7d0df748b4c59651751f156e408f856a02073b69.zip FreeBSD-src-7d0df748b4c59651751f156e408f856a02073b69.tar.gz |
Virgin import of AMD (am-utils) 20030828 (6.0.9)
Diffstat (limited to 'contrib/amd/mk-amd-map')
-rw-r--r-- | contrib/amd/mk-amd-map/.cvsignore | 1 | ||||
-rw-r--r-- | contrib/amd/mk-amd-map/mk-amd-map.8 | 4 | ||||
-rw-r--r-- | contrib/amd/mk-amd-map/mk-amd-map.c | 21 |
3 files changed, 21 insertions, 5 deletions
diff --git a/contrib/amd/mk-amd-map/.cvsignore b/contrib/amd/mk-amd-map/.cvsignore new file mode 100644 index 0000000..70845e0 --- /dev/null +++ b/contrib/amd/mk-amd-map/.cvsignore @@ -0,0 +1 @@ +Makefile.in diff --git a/contrib/amd/mk-amd-map/mk-amd-map.8 b/contrib/amd/mk-amd-map/mk-amd-map.8 index 69f6101..b9587f7 100644 --- a/contrib/amd/mk-amd-map/mk-amd-map.8 +++ b/contrib/amd/mk-amd-map/mk-amd-map.8 @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 1997-2001 Erez Zadok +.\" Copyright (c) 1997-2003 Erez Zadok .\" Copyright (c) 1993 Jan-Simon Pendry .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -33,7 +33,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)mk-amd-map.8 8.1 (Berkeley) 6/28/93 -.\" $Id: mk-amd-map.8,v 1.3.2.1 2001/01/10 03:23:42 ezk Exp $ +.\" $Id: mk-amd-map.8,v 1.3.2.3 2002/12/27 22:45:15 ezk Exp $ .\" .TH MK-AMD-MAP 8 "June 28, 1993" .SH NAME diff --git a/contrib/amd/mk-amd-map/mk-amd-map.c b/contrib/amd/mk-amd-map/mk-amd-map.c index 4177e89..1503600 100644 --- a/contrib/amd/mk-amd-map/mk-amd-map.c +++ b/contrib/amd/mk-amd-map/mk-amd-map.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997-2001 Erez Zadok + * Copyright (c) 1997-2003 Erez Zadok * Copyright (c) 1990 Jan-Simon Pendry * Copyright (c) 1990 Imperial College of Science, Technology & Medicine * Copyright (c) 1990 The Regents of the University of California. @@ -38,7 +38,7 @@ * * %W% (Berkeley) %G% * - * $Id: mk-amd-map.c,v 1.5.2.1 2001/01/10 03:23:42 ezk Exp $ + * $Id: mk-amd-map.c,v 1.5.2.5 2003/06/09 16:57:46 ezk Exp $ */ /* @@ -286,7 +286,22 @@ main(int argc, char *argv[]) exit(1); } +#ifdef HAVE_MKSTEMP + { + /* + * XXX: hack to avoid compiler complaints about mktemp not being + * secure, since we have to do a dbm_open on this anyway. So use + * mkstemp if you can, and then close the fd, but we get a safe + * and unique file name. + */ + int dummyfd; + dummyfd = mkstemp(maptmp); + if (dummyfd >= 0) + close(dummyfd); + } +#else /* not HAVE_MKSTEMP */ mktemp(maptmp); +#endif /* not HAVE_MKSTEMP */ /* remove existing temps (if any) */ #ifdef HAVE_DB_SUFFIX @@ -306,7 +321,7 @@ main(int argc, char *argv[]) } #endif /* not HAVE_DB_SUFFIX */ - db = dbm_open(maptmp, O_RDWR|O_CREAT, 0444); + db = dbm_open(maptmp, O_RDWR|O_CREAT|O_EXCL, 0444); if (!db) { fprintf(stderr, "cannot initialize temporary database: %s", maptmp); exit(1); |