bug-enscript
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-enscript] enscript and temp file location


From: Giulio Orsero
Subject: Re: [bug-enscript] enscript and temp file location
Date: Wed, 12 Nov 2008 19:59:26 +0100

On Wed, Nov 12, 2008 at 6:45 PM, Tapani Tarvainen <address@hidden> wrote:

Unless I'm missing something here, all that's needed is

    static FILE *divertfp;

in the beginning and

    divertftp = fdopen(fd,"w+b");

It was this last line I needed.
Now it works. I used this diff:
===
--- src/psgen.c.orig    2008-11-12 19:38:07.000000000 +0100
+++ src/psgen.c 2008-11-12 19:38:09.000000000 +0100
@@ -25,6 +25,7 @@
  */
 
 #include "gsint.h"
+#include <fcntl.h>
 
 /*
  * Types and definitions.
@@ -2812,8 +2813,20 @@
   assert (divertfp == NULL);
 
   /* Open divert file. */
-
+#if 0
   divertfp = tmpfile ();
+#endif
+  char *filename;
+  int fd;
+
+  do {
+    filename = tempnam (NULL, "enscript");
+    fd = open (filename, O_CREAT | O_EXCL | O_TRUNC | O_RDWR, 0600);
+    free (filename);
+  } while (fd == -1);
+
+  divertfp = fdopen(fd,"w+b");
+
   if (divertfp == NULL)
     FATAL ((stderr, _("couldn't create temporary divert file: %s"),
        strerror (errno)));
==

Thanks!


--
address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]