openbsd-ports/mail/nmh/patches/patch-ac
1998-04-30 04:24:30 +00:00

21 lines
469 B
Plaintext

--- sbr/m_tmpfil.c.~1~ Mon May 19 22:19:12 1997
+++ sbr/m_tmpfil.c Tue Apr 28 22:57:48 1998
@@ -12,9 +12,15 @@
m_tmpfil (char *template)
{
static char tmpfil[BUFSIZ];
+ int fd;
- sprintf(tmpfil, "/tmp/%sXXXXXX", template);
- unlink(mktemp(tmpfil));
+ snprintf(tmpfil, BUFSIZ, "/tmp/%sXXXXXX", template);
+ fd = mkstemp( tmpfil );
+ if ( fd == -1 ) {
+ return 0;
+ }
+ close( fd );
+ unlink( tmpfil );
return tmpfil;
}