- fix gzdopen() call, it does not like mode "r+"
authorMichael Schroeder <mls@suse.de>
Mon, 23 May 2011 11:05:28 +0000 (13:05 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 23 May 2011 11:05:28 +0000 (13:05 +0200)
examples/pysolv
examples/solv.c
ext/sat_xfopen.c

index f6ea3bd..045cf35 100755 (executable)
@@ -495,7 +495,7 @@ class repo_susetags(repo_generic):
        di = self.handle.Dataiterator(solv.SOLVID_META, solv.SUSETAGS_FILE_NAME, None, 0)
        di.prepend_keyname(solv.SUSETAGS_FILE)
        for d in di:
-           filename = d.str
+           filename = d.str()
            if not filename:
                continue
            if filename[0:9] != "packages.":
index 7046181..75418c0 100644 (file)
@@ -850,7 +850,7 @@ curlfopen(struct repoinfo *cinfo, const char *file, int uncompress, const unsign
       return 0;
     }
   if (uncompress)
-    return sat_xfopen_fd(".gz", fd, 0);
+    return sat_xfopen_fd(".gz", fd, "r");
   fcntl(fd, F_SETFD, FD_CLOEXEC);
   return fdopen(fd, "r");
 }
index 07fcfe3..cf943cf 100644 (file)
@@ -80,7 +80,12 @@ sat_xfopen_fd(const char *fn, int fd, const char *mode)
       if (fl == O_WRONLY)
        mode = "w";
       else if (fl == O_RDWR)
-       mode = "r+";
+       {
+         if (!suf || strcmp(suf, ".gz") != 0)
+           mode = "r+";
+         else
+           mode = "r";
+       }
       else
        mode = "r";
     }