openbsd-ports/devel/ddd/patches/patch-ddd_show_C
2002-03-21 05:28:20 +00:00

29 lines
782 B
Plaintext

$OpenBSD: patch-ddd_show_C,v 1.2 2002/03/21 05:28:21 fgsch Exp $
--- ddd/show.C.orig Tue Jan 9 15:00:51 2001
+++ ddd/show.C Wed Mar 13 04:32:04 2002
@@ -58,6 +58,7 @@ char show_rcsid[] =
#include <fstream.h>
#include <string.h>
#include <errno.h>
+#include <unistd.h>
#include "Xpm.h"
#include "HelpCB.h"
@@ -403,11 +404,14 @@ void show_configuration(ostream& os)
static int uncompress(ostream& os, const char *text, int size)
{
- string tempfile = tmpnam(0);
- FILE *fp = fopen(tempfile, "w");
+ char temp_name[] = "/tmp/ddd.XXXXXXXXXX";
+ int temp_fd = mkstemp(temp_name);
+ string tempfile = temp_name;
+ FILE *fp = fdopen(temp_fd, "w");
if (fp == 0)
{
os << tempfile << ": " << strerror(errno);
+ close(temp_fd);
return -1;
}