openbsd-ports/archivers/nulib/patches/patch-aa
1998-02-21 04:07:29 +00:00

25 lines
588 B
Plaintext

--- nuetc.c.~1~ Wed Nov 27 23:48:29 1996
+++ nuetc.c Fri Feb 20 19:46:12 1998
@@ -525,7 +525,20 @@
#ifdef UNIX
strcpy(buffer, "nulb.tmpXXXXXX");
- return mktemp(buffer);
+
+ {
+ /* Note: to really add some security this function should be changed
+ to return the FD of the created temporary file. It's more than
+ I want to do at this time: <marc@snafu.org> */
+
+ int fd = mkstemp(buffer);
+ if ( fd == -1 ) {
+ perror( "can't create temp file" );
+ exit( 1 );
+ }
+ close( fd );
+ return buffer;
+ }
#elif defined(__ORCAC__)
return tmpnam(NULL);