openbsd-ports/archivers/nulib/patches/patch-nuetc_c
2007-10-26 20:25:39 +00:00

26 lines
669 B
Plaintext

$OpenBSD: patch-nuetc_c,v 1.1 2007/10/26 20:25:39 ajacoutot Exp $
--- nuetc.c.orig Thu Nov 28 08:48:29 1996
+++ nuetc.c Fri Oct 26 22:06:17 2007
@@ -525,7 +525,20 @@ char *buffer;
#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);