mkstemp() returns an int, not a FILE *. God, I hate debugging C--.
This commit is contained in:
parent
2e59490083
commit
09580c9a79
@ -1,25 +1,64 @@
|
||||
--- 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 @@
|
||||
#if HAS_MMAP
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
+#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 @@
|
||||
/*
|
||||
* 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);
|
||||
if (tf == NULL)
|
||||
fatal("%s: Cannot open temporary file: %s",
|
||||
(const char*) tempfile, strerror(errno));
|
||||
- Sys::unlink(tempfile); // so it'll be removed on exit
|
||||
|
||||
numcol = fxmax(1,numcol);
|
||||
if (pointSize == -1)
|
||||
*** 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>
|
||||
|
||||
#define LUNIT (72*20) // local coord system is .05 scale
|
||||
#define ICVT(x) ((TextCoord)((x)*LUNIT)) // scale inches to local coordinates
|
||||
***************
|
||||
*** 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+");
|
||||
if (tf == NULL)
|
||||
fatal("%s: Cannot open temporary file: %s",
|
||||
(const char*) tempfile, strerror(errno));
|
||||
- Sys::unlink(tempfile); // so it'll be removed on exit
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user