43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
$NetBSD: patch-ac,v 1.5 2008/06/01 21:49:56 dholland Exp $
|
|
|
|
--- unix/uudeview.c.orig 2003-04-12 19:33:55.000000000 -0400
|
|
+++ unix/uudeview.c 2008-06-01 17:02:31.000000000 -0400
|
|
@@ -31,6 +31,7 @@
|
|
#include <stdio.h>
|
|
#include <ctype.h>
|
|
#include <signal.h>
|
|
+#include <paths.h>
|
|
|
|
#ifdef HAVE_FCNTL_H
|
|
#include <fcntl.h>
|
|
@@ -440,6 +441,7 @@
|
|
{
|
|
static char buffer[1024];
|
|
char *stdfile;
|
|
+ int targetfd;
|
|
FILE *target;
|
|
size_t bytes;
|
|
int res;
|
|
@@ -449,11 +451,20 @@
|
|
return 0;
|
|
}
|
|
|
|
- if ((stdfile = tempnam (NULL, "uu")) == NULL) {
|
|
+ if ((stdfile = strdup (_PATH_TMP "uu.XXXXXX")) == NULL) {
|
|
fprintf (stderr, "proc_stdin: cannot get temporary file\n");
|
|
return 0;
|
|
}
|
|
|
|
+ if ((targetfd = mkstemp (stdfile)) < 0) {
|
|
+ fprintf (stderr, "proc_stdin: cannot open temp file %s for writing: %s\n",
|
|
+ stdfile, strerror (errno));
|
|
+ _FP_free (stdfile);
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
+ /* file now safely exists, reopen it with the right mode */
|
|
+ close(targetfd);
|
|
if ((target = fopen (stdfile, "wb")) == NULL) {
|
|
fprintf (stderr, "proc_stdin: cannot open temp file %s for writing: %s\n",
|
|
stdfile, strerror (errno));
|