$OpenBSD: patch-src_editpwin_c,v 1.2 2003/03/31 16:58:55 sturm Exp $
--- src/editpwin.c.orig	Wed Aug 21 21:37:59 2002
+++ src/editpwin.c	Thu Mar  6 21:57:56 2003
@@ -770,15 +770,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);
