mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-08-08 17:42:14 +03:00
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
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
Tue Oct 30 11:31:19 CET 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* xmlIO.c: closing bug #62711, the library should never
|
||||||
|
close stdin or stdout.
|
||||||
|
|
||||||
Tue Oct 30 10:46:12 CET 2001 Daniel Veillard <daniel@veillard.com>
|
Tue Oct 30 10:46:12 CET 2001 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* uri.c: second pass at fixing #63336, using Joel Young
|
* uri.c: second pass at fixing #63336, using Joel Young
|
||||||
|
11
xmlIO.c
11
xmlIO.c
@@ -392,6 +392,13 @@ xmlFileWrite (void * context, const char * buffer, int len) {
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xmlFileClose (void * context) {
|
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 );
|
return ( ( fclose((FILE *) context) == EOF ) ? -1 : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +447,7 @@ xmlGzfileOpen (const char *filename) {
|
|||||||
gzFile fd;
|
gzFile fd;
|
||||||
|
|
||||||
if (!strcmp(filename, "-")) {
|
if (!strcmp(filename, "-")) {
|
||||||
fd = gzdopen(fileno(stdin), "rb");
|
fd = gzdopen(dup(0), "rb");
|
||||||
return((void *) fd);
|
return((void *) fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,7 +489,7 @@ xmlGzfileOpenW (const char *filename, int compression) {
|
|||||||
|
|
||||||
sprintf(mode, "wb%d", compression);
|
sprintf(mode, "wb%d", compression);
|
||||||
if (!strcmp(filename, "-")) {
|
if (!strcmp(filename, "-")) {
|
||||||
fd = gzdopen(1, mode);
|
fd = gzdopen(dup(1), mode);
|
||||||
return((void *) fd);
|
return((void *) fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user