use O_EXCL with O_CREAT when making the temporary db files
This commit is contained in:
parent
cd08442b0d
commit
789002a23e
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: makedbm.c,v 1.1.1.1 1996/08/09 10:14:54 thorpej Exp $ */
|
/* $NetBSD: makedbm.c,v 1.2 1997/03/22 03:32:36 lukem Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
|
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
|
||||||
@ -272,7 +272,7 @@ create_database(infile, database, yp_input_file, yp_output_file,
|
|||||||
snprintf(db_mapname, sizeof(db_mapname), "%s%s",
|
snprintf(db_mapname, sizeof(db_mapname), "%s%s",
|
||||||
db_tempname, YPDB_SUFFIX);
|
db_tempname, YPDB_SUFFIX);
|
||||||
|
|
||||||
new_db = ypdb_open(db_tempname, O_RDWR | O_CREAT, 0644);
|
new_db = ypdb_open(db_tempname, O_RDWR | O_CREAT | O_EXCL, 0644);
|
||||||
if (new_db == NULL)
|
if (new_db == NULL)
|
||||||
errx(1, "can't create temp database `%s'", db_tempname);
|
errx(1, "can't create temp database `%s'", db_tempname);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: ypxfr.c,v 1.2 1996/08/15 22:17:57 chuck Exp $ */
|
/* $NetBSD: ypxfr.c,v 1.3 1997/03/22 03:32:40 lukem Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
|
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
|
||||||
@ -400,7 +400,7 @@ create_db(domain, map, temp_map)
|
|||||||
YP_DB_PATH, domain, temp_map);
|
YP_DB_PATH, domain, temp_map);
|
||||||
db_temp[sizeof(db_temp) - 1] = '\0';
|
db_temp[sizeof(db_temp) - 1] = '\0';
|
||||||
|
|
||||||
db = ypdb_open(db_temp, O_RDWR|O_CREAT, 0444);
|
db = ypdb_open(db_temp, O_RDWR|O_CREAT|O_EXCL, 0444);
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user