openbsd-ports/cad/chipmunk/patches/patch-log_src_log_c
espie a8c2b00374 local function declarations don't mean anything in C, and gcc4 complains
more loudly.

regen patches with newer diff while I'm there.
2010-05-09 17:18:53 +00:00

51 lines
1.2 KiB
Plaintext

$OpenBSD: patch-log_src_log_c,v 1.2 2010/05/09 17:18:53 espie Exp $
--- log/src/log.c.orig Wed Mar 12 23:49:30 2003
+++ log/src/log.c Sun May 9 19:14:48 2010
@@ -2865,6 +2865,8 @@ Static Void show_events()
}
+Static boolean pollkbd2(void);
+
Static Void pen()
{
@@ -2873,7 +2875,6 @@ Static Void pen()
long x, y;
short i, rx, ry, cred;
- Static boolean pollkbd2(void);
static oldx, oldy;
static long awake;
long now;
@@ -21278,6 +21279,9 @@ Static Void initialize()
short FORLIM;
nk_keytransinfo *WITH;
log_sigrec *WITH1;
+ int fd = -1;
+ char tmpf[25] = "/tmp/chipmunk.XXXXXXXXXX";
+ FILE *tmpp;
#ifdef OS2
_control87(EM_UNDERFLOW, EM_UNDERFLOW); /* Turn off underflow exception. */
@@ -21576,8 +21580,17 @@ Static Void initialize()
if (flag) {
if (libf1[k]->f != NULL)
rewind(libf1[k]->f);
- else
- libf1[k]->f = tmpfile();
+ else {
+ if ((fd = mkstemp(tmpf)) == -1 ||
+ (tmpp = fdopen(fd, "w+")) == NULL) {
+ if (fd != -1) {
+ unlink(tmpf);
+ close(fd);
+ }
+ libf1[k]->f = NULL;
+ } else
+ libf1[k]->f = tmpp;
+ }
if (libf1[k]->f == NULL) {
P_escapecode = -10;
P_ioresult = FileNotFound;