- 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 f6ea3bd120ee68e75315dad0e4da36d89a0e0299..045cf352319096677a3749c46f8fa9c54b2a109c 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 70461813eac2444376bfccdc354b4e9453cc66b2..75418c07b8148d1c4653c6dd54a480f54315ca32 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 07fcfe37d9812e7716aebb41aadabd6f9b0b5d9f..cf943cf7b2d6eb118b440ed8ab3e6eae1034019e 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";
     }