|
|
@@ -0,0 +1,39 @@
|
|
|
+It is not portable to use "std{in,out}" as "lvalues" (for instance,
|
|
|
+building under Sun Solaris breaks here). The portable solution is to use
|
|
|
+freopen(3). Unfortunately, to achieve the same effect than fdopen(3) on
|
|
|
+"std{in,out}", one has to use "/dev/std{in,out}" (which in turn is not
|
|
|
+really portable, but at least more portable than using "std{in,out}"
|
|
|
+as "lvalues"). The only "we know it better" alternative would be to
|
|
|
+just replace the code with a fflush(3) on the streams and know that the
|
|
|
+stream has not recognized the changed underlying filedescriptor. But
|
|
|
+this again is not really portable, although also working for mostly all
|
|
|
+Unix platforms.
|
|
|
+
|
|
|
+--- filter.c.orig 2003-03-25 17:39:08.000000000 +0100
|
|
|
++++ filter.c 2003-07-24 10:05:02.000000000 +0200
|
|
|
+@@ -158,10 +158,10 @@
|
|
|
+ int r;
|
|
|
+
|
|
|
+ /* setup streams again */
|
|
|
+- if ((stdin = fdopen (0, "r")) == NULL)
|
|
|
+- flexfatal (_("fdopen(0) failed"));
|
|
|
+- if ((stdout = fdopen (1, "w")) == NULL)
|
|
|
+- flexfatal (_("fdopen(1) failed"));
|
|
|
++ if ((freopen ("/dev/stdin", "r", stdin)) == NULL)
|
|
|
++ flexfatal (_("freopen(stdin) failed"));
|
|
|
++ if ((freopen ("/dev/stdout", "w", stdout)) == NULL)
|
|
|
++ flexfatal (_("freopen(stdout) failed"));
|
|
|
+
|
|
|
+ if ((r = chain->filter_func (chain)) == -1)
|
|
|
+ flexfatal (_("filter_func failed"));
|
|
|
+@@ -181,8 +181,8 @@
|
|
|
+ if (dup2 (pipes[1], 1) == -1)
|
|
|
+ flexfatal (_("dup2(pipes[1],1)"));
|
|
|
+ close (pipes[1]);
|
|
|
+- if ((stdout = fdopen (1, "w")) == NULL)
|
|
|
+- flexfatal (_("fdopen(1) failed"));
|
|
|
++ if ((freopen ("/dev/stdout", "w", stdout)) == NULL)
|
|
|
++ flexfatal (_("freopen(stdout) failed"));
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|