From: Michael Schroeder Date: Mon, 23 May 2011 11:05:28 +0000 (+0200) Subject: - fix gzdopen() call, it does not like mode "r+" X-Git-Tag: BASE-SuSE-Code-12_1-Branch~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=29b5924fea5ba3a7033079292d8129a6d882e364;p=platform%2Fupstream%2Flibsolv.git - fix gzdopen() call, it does not like mode "r+" --- diff --git a/examples/pysolv b/examples/pysolv index f6ea3bd..045cf35 100755 --- a/examples/pysolv +++ b/examples/pysolv @@ -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.": diff --git a/examples/solv.c b/examples/solv.c index 7046181..75418c0 100644 --- a/examples/solv.c +++ b/examples/solv.c @@ -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"); } diff --git a/ext/sat_xfopen.c b/ext/sat_xfopen.c index 07fcfe3..cf943cf 100644 --- a/ext/sat_xfopen.c +++ b/ext/sat_xfopen.c @@ -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"; }