summaryrefslogtreecommitdiff
path: root/shells/bash/patches/patch-aa
blob: 21c03b277f387503655edf6bfeec4f186a048f49 (plain)
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.5 2010/02/09 12:31:19 wiz Exp $

--- lib/sh/fpurge.c.orig	2009-04-20 01:12:23.000000000 +0000
+++ lib/sh/fpurge.c
@@ -53,7 +53,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:
@@ -63,6 +63,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;
 
@@ -81,7 +84,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? */