1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
$NetBSD: patch-aa,v 1.6 2011/03/12 15:26:45 wiz Exp $
--- lib/sh/fpurge.c.orig 2010-12-22 14:32:58.000000000 +0000
+++ lib/sh/fpurge.c
@@ -137,7 +137,7 @@ fpurge (FILE *fp)
extern int fpurge (FILE *);
# endif
int result = fpurge (fp);
-# if defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+# if defined __sferror /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
if (result == 0)
/* Correct the invariants that fpurge broke.
<stdio.h> on BSD systems says:
@@ -147,6 +147,9 @@ fpurge (FILE *fp)
into the buffer, although they shouldn't be allowed to. */
if ((fp_->_flags & __SRD) != 0)
fp_->_w = 0;
+#elif defined __DragonFly__
+ if ((((struct __FILE_public *) fp_)->_flags & __SRD) != 0)
+ ((struct __FILE_public *) fp_)->_w = 0;
# endif
return result;
@@ -165,7 +168,7 @@ fpurge (FILE *fp)
fp->_IO_save_base = NULL;
}
return 0;
-# elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, MacOS X, Cygwin */
+# elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
fp_->_p = fp_->_bf._base;
fp_->_r = 0;
fp_->_w = ((fp_->_flags & (__SLBF | __SNBF | __SRD)) == 0 /* fully buffered and not currently reading? */
|