aboutsummaryrefslogtreecommitdiffstats
path: root/xmlIO.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-10-30 10:32:36 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-10-30 10:32:36 +0000
commita9e65e8be296953aa4f6df75b2cae7d0e70f5d2b (patch)
tree3144f9ff94957288484e392d8df1b0dc9aa35c65 /xmlIO.c
parent4def3bd94c4c34ad0b7b2848f7f43a62c9ea067c (diff)
downloadandroid_external_libxml2-a9e65e8be296953aa4f6df75b2cae7d0e70f5d2b.tar.gz
android_external_libxml2-a9e65e8be296953aa4f6df75b2cae7d0e70f5d2b.tar.bz2
android_external_libxml2-a9e65e8be296953aa4f6df75b2cae7d0e70f5d2b.zip
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
Diffstat (limited to 'xmlIO.c')
-rw-r--r--xmlIO.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/xmlIO.c b/xmlIO.c
index fac91324..ceb9c4f1 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -392,6 +392,13 @@ xmlFileWrite (void * context, const char * buffer, int len) {
*/
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 @@ xmlGzfileOpen (const char *filename) {
gzFile fd;
if (!strcmp(filename, "-")) {
- fd = gzdopen(fileno(stdin), "rb");
+ fd = gzdopen(dup(0), "rb");
return((void *) fd);
}
@@ -482,7 +489,7 @@ xmlGzfileOpenW (const char *filename, int compression) {
sprintf(mode, "wb%d", compression);
if (!strcmp(filename, "-")) {
- fd = gzdopen(1, mode);
+ fd = gzdopen(dup(1), mode);
return((void *) fd);
}