closing bug #62711, the library should never close stdin or stdout. Daniel
* xmlIO.c: closing bug #62711, the library should never
close stdin or stdout.
Daniel
diff --git a/xmlIO.c b/xmlIO.c
index fac9132..ceb9c4f 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -392,6 +392,13 @@
*/
static int
xmlFileClose (void * context) {
+ FILE *fil;
+
+ fil = (FILE *) context;
+ if (fil == stdin)
+ return(0);
+ if (fil == stdout)
+ return(0);
return ( ( fclose((FILE *) context) == EOF ) ? -1 : 0 );
}
@@ -440,7 +447,7 @@
gzFile fd;
if (!strcmp(filename, "-")) {
- fd = gzdopen(fileno(stdin), "rb");
+ fd = gzdopen(dup(0), "rb");
return((void *) fd);
}
@@ -482,7 +489,7 @@
sprintf(mode, "wb%d", compression);
if (!strcmp(filename, "-")) {
- fd = gzdopen(1, mode);
+ fd = gzdopen(dup(1), mode);
return((void *) fd);
}