diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-07-27 22:21:58 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-10-05 12:02:19 +0200 |
commit | df47efeb5764bba8ac4789727f9ffe970e5cd756 (patch) | |
tree | f3582e3a74f911949eb6a9b87adf31275c3f468c | |
parent | 6a6bcc4b3365a4455539271f87be1fa55ea237f1 (diff) |
(error) va_list 'args' was opened but not closed by va_end()
Reported-By: cppcheck
Gbp-Dch: Ignore
(cherry picked from commit 196d590a99e309764e07c9dc23ea98897eebf53a)
-rw-r--r-- | apt-pkg/contrib/error.cc | 34 | ||||
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 18 | ||||
-rw-r--r-- | apt-pkg/edsp.cc | 2 | ||||
-rwxr-xr-x | test/integration/test-releasefile-verification | 2 |
4 files changed, 26 insertions, 30 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index 8a87e16e9..c06ea8364 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -68,13 +68,12 @@ bool GlobalError::NAME (const char *Function, const char *Description,...) { \ va_list args; \ size_t msgSize = 400; \ int const errsv = errno; \ - while (true) { \ + bool retry; \ + do { \ va_start(args,Description); \ - bool const retry = InsertErrno(TYPE, Function, Description, args, errsv, msgSize); \ + retry = InsertErrno(TYPE, Function, Description, args, errsv, msgSize); \ va_end(args); \ - if (retry == false) \ - break; \ - } \ + } while (retry); \ return false; \ } GEMessage(FatalE, FATAL) @@ -90,13 +89,12 @@ bool GlobalError::InsertErrno(MsgType const &type, const char *Function, va_list args; size_t msgSize = 400; int const errsv = errno; - while (true) { + bool retry; + do { va_start(args,Description); - bool const retry = InsertErrno(type, Function, Description, args, errsv, msgSize); + retry = InsertErrno(type, Function, Description, args, errsv, msgSize); va_end(args); - if (retry == false) - break; - } + } while (retry); return false; } /*}}}*/ @@ -127,12 +125,12 @@ bool GlobalError::InsertErrno(MsgType type, const char* Function, bool GlobalError::NAME (const char *Description,...) { \ va_list args; \ size_t msgSize = 400; \ - while (true) { \ + bool retry; \ + do { \ va_start(args,Description); \ - if (Insert(TYPE, Description, args, msgSize) == false) \ - break; \ + retry = Insert(TYPE, Description, args, msgSize); \ va_end(args); \ - } \ + } while (retry); \ return false; \ } GEMessage(Fatal, FATAL) @@ -147,12 +145,12 @@ bool GlobalError::Insert(MsgType const &type, const char *Description,...) { va_list args; size_t msgSize = 400; - while (true) { + bool retry; + do { va_start(args,Description); - if (Insert(type, Description, args, msgSize) == false) - break; + retry = Insert(type, Description, args, msgSize); va_end(args); - } + } while (retry); return false; } /*}}}*/ diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index b041ef131..76eb6c7f0 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -2656,13 +2656,12 @@ bool FileFd::FileFdErrno(const char *Function, const char *Description,...) va_list args; size_t msgSize = 400; int const errsv = errno; - while (true) - { + bool retry; + do { va_start(args,Description); - if (_error->InsertErrno(GlobalError::ERROR, Function, Description, args, errsv, msgSize) == false) - break; + retry = _error->InsertErrno(GlobalError::ERROR, Function, Description, args, errsv, msgSize); va_end(args); - } + } while (retry); return false; } /*}}}*/ @@ -2671,13 +2670,12 @@ bool FileFd::FileFdError(const char *Description,...) { Flags |= Fail; va_list args; size_t msgSize = 400; - while (true) - { + bool retry; + do { va_start(args,Description); - if (_error->Insert(GlobalError::ERROR, Description, args, msgSize) == false) - break; + retry = _error->Insert(GlobalError::ERROR, Description, args, msgSize); va_end(args); - } + } while (retry); return false; } /*}}}*/ diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 38ac36831..466be3030 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -183,7 +183,7 @@ static void WriteScenarioLimitedDependency(FILE* output, static bool SkipUnavailableVersions(pkgDepCache &Cache, pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver)/*{{{*/ { /* versions which aren't current and aren't available in - any "online" source file are bad, expect if they are the choosen + any "online" source file are bad, expect if they are the chosen candidate: The exception is for build-dep implementation as it creates such pseudo (package) versions and removes them later on again. We filter out versions at all so packages in 'rc' state only available diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification index 19d5cb9bc..ebdb4d641 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -296,7 +296,7 @@ cat > rootdir/etc/apt/apt.conf.d/weaken-security <<EOF Acquire::AllowInsecureRepositories "1"; Acquire::AllowDowngradeToInsecureRepositories "1"; EOF -# the hash marked as configureable in our gpgv method +# the hash marked as configurable in our gpgv method export APT_TESTS_DIGEST_ALGO='SHA224' successfulaptgetupdate() { |