mkstemp() returns an int, not a FILE *. God, I hate debugging C--.

This commit is contained in:
downsj 1998-11-10 00:03:48 +00:00
parent 2e59490083
commit 09580c9a79

View File

@ -1,21 +1,39 @@
--- util/TextFmt.c++.orig Wed Sep 2 16:50:49 1998
+++ util/TextFmt.c++ Wed Sep 2 16:58:43 1998
@@ -47,6 +47,7 @@
*** util/Sys.h.orig Sat Feb 14 02:47:52 1998
--- util/Sys.h Mon Nov 9 15:58:16 1998
***************
*** 126,131 ****
--- 126,133 ----
static int mkstemp(char* templ) { return ::mkstemp(templ); }
static FILE* fopen(const char* filename, const char* mode)
{ return ::fopen(filename, mode); }
+ static FILE* fdopen(int fd, const char* mode)
+ { return ::fdopen(fd, mode); }
static int getOpenMax();
};
*** util/TextFmt.c++.orig Sat Feb 14 02:47:30 1998
--- util/TextFmt.c++ Mon Nov 9 15:55:13 1998
***************
*** 47,52 ****
--- 47,53 ----
#if HAS_MMAP
#include <sys/mman.h>
#endif
+#include <paths.h>
+ #include <paths.h>
#define LUNIT (72*20) // local coord system is .05 scale
#define ICVT(x) ((TextCoord)((x)*LUNIT)) // scale inches to local coordinates
@@ -244,12 +245,11 @@
***************
*** 240,255 ****
output = o;
pageHeight = ICVT(physPageHeight);
pageWidth = ICVT(physPageWidth);
/*
* Open the file w+ so that we can reread the temp file.
*/
- tempfile = tmpnam(NULL);
- tf = Sys::fopen(tempfile, "w+");
+ tempfile = _PATH_TMP ".hylafax.XXXXXXXXXXXX";
+ tf = Sys::mkstemp(tempfile);
! tempfile = tmpnam(NULL);
! tf = Sys::fopen(tempfile, "w+");
if (tf == NULL)
fatal("%s: Cannot open temporary file: %s",
(const char*) tempfile, strerror(errno));
@ -23,3 +41,24 @@
numcol = fxmax(1,numcol);
if (pointSize == -1)
--- 241,260 ----
output = o;
pageHeight = ICVT(physPageHeight);
pageWidth = ICVT(physPageWidth);
+ int fd;
/*
* Open the file w+ so that we can reread the temp file.
*/
! tempfile = _PATH_TMP ".hylafax.XXXXXXXXXXXX";
! fd = Sys::mkstemp(tempfile);
! if (fd == -1)
! fatal("%s: Cannot open temporary file: %s",
! (const char*) tempfile, strerror(errno));
! tf = Sys::fdopen(fd, "w+");
if (tf == NULL)
fatal("%s: Cannot open temporary file: %s",
(const char*) tempfile, strerror(errno));
numcol = fxmax(1,numcol);
if (pointSize == -1)