pkgsrc/devel/prcs/patches/patch-aa
shattered 2ddf9f5990 PR/41638 -- dup() the descriptor before passing it to stdio_filebuf,
so it can be closed without affecting anybody else. gcc < 3.4 used to
have a separate argument to control this behaviour which was apparently
removed.

Untested, please report any problems to GNATS.
2011-10-04 20:52:09 +00:00

19 lines
917 B
Text

$NetBSD: patch-aa,v 1.7 2011/10/04 20:52:09 shattered Exp $
PR 41638 -- dup() the descriptor before passing it to stdio_filebuf,
so it can be closed without affecting anybody else. gcc < 3.4 used to
have a separate argument to control this behaviour which was apparently
removed.
--- src/rebuild.cc.orig 2006-06-03 00:54:52.000000000 +0000
+++ src/rebuild.cc
@@ -1001,6 +1001,9 @@ void RebuildFile::init_stream()
#elif __GNUG__ == 3 and __GNUC_MINOR__ < 2
buf = new filebuf(fdopen(dup(seg->fd()), "a+"), ios::out);
buf->pubseekoff(0, ios::end, ios::out);
+#elif __GNUG__ > 3 || (__GNUG__ == 3 && __GNUC_MINOR__ >= 4)
+ buf = new __gnu_cxx::stdio_filebuf<char> (dup(seg->fd()), ios::out, default_segment_size);
+ buf->pubseekoff(0, ios::end, ios::out);
#else
buf = new __gnu_cxx::stdio_filebuf<char> (seg->fd(), ios::out,
false /* close */, default_segment_size);