34 lines
881 B
Plaintext
34 lines
881 B
Plaintext
|
$OpenBSD: patch-log_src_loged_c,v 1.1.1.1 2003/10/25 18:33:27 pvalchev Exp $
|
||
|
--- log/src/loged.c.orig 2003-03-12 15:49:30.000000000 -0700
|
||
|
+++ log/src/loged.c 2003-10-25 10:51:38.000000000 -0600
|
||
|
@@ -1956,6 +1956,9 @@ Char *s_, *gname_;
|
||
|
descrec *WITH;
|
||
|
vectorrec *WITH2;
|
||
|
Char STR5[256];
|
||
|
+ int fd = -1;
|
||
|
+ char tmpf[25] = "/tmp/chipmunk.XXXXXXXXXX";
|
||
|
+ FILE *tmpp;
|
||
|
|
||
|
strcpy(s, s_);
|
||
|
strcpy(gname, gname_);
|
||
|
@@ -2032,8 +2035,17 @@ Char *s_, *gname_;
|
||
|
/* p2c: loged.text, line 1701: Note: OPEN does not specify a name [181] */
|
||
|
if (V.f != NULL)
|
||
|
rewind(V.f);
|
||
|
- else
|
||
|
- V.f = tmpfile();
|
||
|
+ else {
|
||
|
+ if ((fd == mkstemp(tmpf)) == -1 ||
|
||
|
+ (tmpp = fdopen(fd, "w+")) == NULL) {
|
||
|
+ if (fd != -1) {
|
||
|
+ unlink(tmpf);
|
||
|
+ close(fd);
|
||
|
+ }
|
||
|
+ V.f = NULL;
|
||
|
+ } else
|
||
|
+ V.f = tmpp;
|
||
|
+ }
|
||
|
if (V.f == NULL) {
|
||
|
P_escapecode = -10;
|
||
|
P_ioresult = FileNotFound;
|