summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authormartin@piware.de <>2010-06-24 21:27:27 +0200
committermartin@piware.de <>2010-06-24 21:27:27 +0200
commitc4fc2fd7fa0fc63fd8cd6bc9b73492e6baf0222a (patch)
tree04161940fbd86e574ddd5de1dca4e974af77c524 /apt-pkg/contrib
parent9d706e45650240cb7b05104211d93220dd6f614c (diff)
Switch FileFd to not transparently gunzip, since that breaks code which expects the compressed contents to stay (such as the copy backend, or when using file:// repositories. Instead, introduce a new ReadOnlyGzip mode and use that where needed
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/fileutl.cc14
-rw-r--r--apt-pkg/contrib/fileutl.h2
2 files changed, 10 insertions, 6 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 11a9e7f7b..2b91a46f7 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -604,12 +604,16 @@ bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
{
case ReadOnly:
iFd = open(FileName.c_str(),O_RDONLY);
+ break;
+
+ case ReadOnlyGzip:
+ iFd = open(FileName.c_str(),O_RDONLY);
if (iFd > 0 && FileName.compare(FileName.size()-3, 3, ".gz") == 0) {
- gz = gzdopen (iFd, "r");
- if (gz == NULL) {
- close (iFd);
- iFd = -1;
- }
+ gz = gzdopen (iFd, "r");
+ if (gz == NULL) {
+ close (iFd);
+ iFd = -1;
+ }
}
break;
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 9925bbed4..c4b282126 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -41,7 +41,7 @@ class FileFd
gzFile gz;
public:
- enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp};
+ enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,WriteTemp,ReadOnlyGzip};
inline bool Read(void *To,unsigned long Size,bool AllowEof)
{