summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-08-05 22:51:30 +0200
committerMichael Vogt <mvo@debian.org>2013-08-05 22:51:30 +0200
commitafc2891fdac29848826a7f9cdeb22ce0c2409350 (patch)
treef7c5c2ea862eca5d28bbb4d45181d6f21e60d06f /apt-pkg/contrib
parent4ccd3b3ce69d6a6598e1773689a44fdec78a85cc (diff)
parent64876cf7963f897efa70c3e424527e2e8651aa29 (diff)
Merge remote-tracking branch 'upstream/debian/sid' into bugfix/coverity
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/error.cc10
-rw-r--r--apt-pkg/contrib/fileutl.cc23
2 files changed, 24 insertions, 9 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index 122e2c809..d457781c3 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -67,9 +67,10 @@ bool GlobalError::NAME (const char *Function, const char *Description,...) { \
int const errsv = errno; \
while (true) { \
va_start(args,Description); \
- if (InsertErrno(TYPE, Function, Description, args, errsv, msgSize) == false) \
- break; \
+ bool const retry = InsertErrno(TYPE, Function, Description, args, errsv, msgSize); \
va_end(args); \
+ if (retry == false) \
+ break; \
} \
return false; \
}
@@ -88,9 +89,10 @@ bool GlobalError::InsertErrno(MsgType const &type, const char *Function,
int const errsv = errno;
while (true) {
va_start(args,Description);
- if (InsertErrno(type, Function, Description, args, errsv, msgSize) == false)
- break;
+ bool const retry = InsertErrno(type, Function, Description, args, errsv, msgSize);
va_end(args);
+ if (retry == false)
+ break;
}
return false;
}
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 0b6e07f75..f24df65fc 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1599,7 +1599,11 @@ unsigned long long FileFd::Size()
char ignore[1000];
unsigned long long read = 0;
do {
- Read(ignore, sizeof(ignore), &read);
+ if (Read(ignore, sizeof(ignore), &read) == false)
+ {
+ Seek(oldSeek);
+ return 0;
+ }
} while(read != 0);
size = Tell();
Seek(oldSeek);
@@ -1616,10 +1620,16 @@ unsigned long long FileFd::Size()
* bits of the file */
// FIXME: Size for gz-files is limited by 32bit… no largefile support
if (lseek(iFd, -4, SEEK_END) < 0)
- return FileFdErrno("lseek","Unable to seek to end of gzipped file");
- size = 0L;
+ {
+ FileFdErrno("lseek","Unable to seek to end of gzipped file");
+ return 0;
+ }
+ size = 0;
if (read(iFd, &size, 4) != 4)
- return FileFdErrno("read","Unable to read original size of gzipped file");
+ {
+ FileFdErrno("read","Unable to read original size of gzipped file");
+ return 0;
+ }
#ifdef WORDS_BIGENDIAN
uint32_t tmp_size = size;
@@ -1629,7 +1639,10 @@ unsigned long long FileFd::Size()
#endif
if (lseek(iFd, oldPos, SEEK_SET) < 0)
- return FileFdErrno("lseek","Unable to seek in gzipped file");
+ {
+ FileFdErrno("lseek","Unable to seek in gzipped file");
+ return 0;
+ }
return size;
}