openbsd-ports/mail/nmh/patches/patch-sbr_m_scratch_c

31 lines
765 B
Plaintext
Raw Normal View History

2002-09-29 20:29:02 -04:00
$OpenBSD: patch-sbr_m_scratch_c,v 1.1 2002/09/30 00:29:02 pvalchev Exp $
--- sbr/m_scratch.c.orig Fri Jan 28 16:30:17 2000
+++ sbr/m_scratch.c Mon Sep 30 18:22:06 2002
@@ -15,16 +15,20 @@ m_scratch (char *file, char *template)
1998-04-30 00:24:30 -04:00
static char buffer[BUFSIZ], tmpfil[BUFSIZ];
snprintf (tmpfil, sizeof(tmpfil), "%sXXXXXX", template);
-/*
- Mkstemp work postponed until later -Doug
#ifdef HAVE_MKSTEMP
- mkstemp (tmpfil);
+ {
+ int fd;
+
+ fd = mkstemp (tmpfil);
+ if (fd == -1)
+ return 0;
+ close (fd);
+ unlink (tmpfil);
+ }
#else
-*/
mktemp (tmpfil);
-/*
#endif
-*/
+
/* nasty - this really means: if there is no '/' in the path */
1998-04-30 00:24:30 -04:00
if ((cp = r1bindex (file, '/')) == file)
strncpy (buffer, tmpfil, sizeof(buffer));