Commit 4777232c authored by Ben Collins's avatar Ben Collins
Browse files

when opening files in /tmp use O_CREAT|O_EXCL to overcome race conditions

parent 7fa830b7
...@@ -501,7 +501,7 @@ edit_entry( char c, Datum *data ) ...@@ -501,7 +501,7 @@ edit_entry( char c, Datum *data )
strcpy( tmpname, "/tmp/dbtestXXXXXX" ); strcpy( tmpname, "/tmp/dbtestXXXXXX" );
#ifndef HAVE_MKSTEMP #ifndef HAVE_MKSTEMP
if ( (fd = open( mktemp( tmpname ), O_RDWR, 0600 )) == -1 ) { if ( (fd = open( mktemp( tmpname ), O_RDWR|O_CREAT|O_EXCL, 0600 )) == -1 ) {
perror( tmpname ); perror( tmpname );
return; return;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment