openbsd-ports/math/grace/patches/patch-src_editpwin_c
naddy a286ae3597 Update to 5.1.9.
From: maintainer Nikolay Sturm <sturm@sec.informatik.tu-darmstadt.de>.
2002-08-27 11:48:56 +00:00

30 lines
841 B
Plaintext

$OpenBSD: patch-src_editpwin_c,v 1.1 2002/08/27 11:48:56 naddy Exp $
--- src/editpwin.c.orig Thu Jul 13 00:31:47 2000
+++ src/editpwin.c Mon Aug 26 11:04:14 2002
@@ -769,15 +769,19 @@ void create_ss_frame(int gno, int setno)
*/
void do_ext_editor(int gno, int setno)
{
- char *fname, ebuf[256];
+ char fname[GR_MAXPATHLEN], ebuf[256];
FILE *cp;
- int save_autos;
+ int save_autos, fd;
- fname = tmpnam(NULL);
- cp = grace_openw(fname);
- if (cp == NULL) {
+ strlcpy(fname, P_tmpdir, sizeof fname);
+ strlcat(fname, "grace-XXXXXXXXXX", sizeof fname);
+ fd = mkstemp(fname);
+ if (fd == -1) {
+ errmsg("Could not create tmp file.");
return;
- }
+ } else
+ close(fd);
+ cp = filter_write(fname);
write_set(gno, setno, cp, sformat, FALSE);
grace_close(cp);