[libxml2] Portability fix



commit 147aaf21eaf57b1b685b757b23b5c1ce32d9412a
Author: Patrick Monnerat <Patrick Monnerat datasphere ch>
Date:   Thu Dec 12 15:02:40 2013 +0800

    Portability fix
    
    Don't assume fileno for stdin and stdout are 0 and 1

 xmlIO.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/xmlIO.c b/xmlIO.c
index fc4e111..d1544f3 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -1159,7 +1159,7 @@ xmlGzfileOpen_real (const char *filename) {
     gzFile fd;
 
     if (!strcmp(filename, "-")) {
-        fd = gzdopen(dup(0), "rb");
+        fd = gzdopen(dup(fileno(stdin)), "rb");
        return((void *) fd);
     }
 
@@ -1233,7 +1233,7 @@ xmlGzfileOpenW (const char *filename, int compression) {
 
     snprintf(mode, sizeof(mode), "wb%d", compression);
     if (!strcmp(filename, "-")) {
-        fd = gzdopen(dup(1), mode);
+        fd = gzdopen(dup(fileno(stdout)), mode);
        return((void *) fd);
     }
 
@@ -1355,7 +1355,7 @@ xmlXzfileOpen_real (const char *filename) {
     xzFile fd;
 
     if (!strcmp(filename, "-")) {
-        fd = __libxml2_xzdopen(dup(0), "rb");
+        fd = __libxml2_xzdopen(dup(fileno(stdin)), "rb");
        return((void *) fd);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]