$OpenBSD: patch-sam_unix_c,v 1.1 2002/11/04 10:28:56 markus Exp $
--- sam/unix.c.orig	Wed Oct 30 21:05:49 2002
+++ sam/unix.c	Wed Oct 30 21:05:50 2002
@@ -147,18 +147,18 @@ notifyf(void *a, char *b)	/* never calle
 int
 newtmp(int i)
 {
-	char *s;
-	FILE *f;
-	extern char *tempnam(const char*, const char*);
+	char file[40];
+	int fd;
+	extern int mkstemp(char *);
 
-	s = tempnam(TMPDIR, "sam.");
-	if (!s)
+	snprintf(file, 40, "%s/sam.XXXXXXXXXX", TMPDIR);
+	fd = mkstemp(file);
+	if(fd < 0){
+		unlink(file);
 		return -1;
-	f = fopen(s, "w+");
-	if (!f)
-		return -1;
-	unlink(s);
-	return fileno(f);
+	}
+	unlink(file);
+	return fd;
 }
 
 void
