]> git.saurik.com Git - apt.git/commitdiff
(error) va_list 'args' was opened but not closed by va_end()
authorDavid Kalnischkies <david@kalnischkies.de>
Wed, 27 Jul 2016 20:21:58 +0000 (22:21 +0200)
committerJulian Andres Klode <jak@debian.org>
Wed, 5 Oct 2016 10:02:19 +0000 (12:02 +0200)
Reported-By: cppcheck
Gbp-Dch: Ignore
(cherry picked from commit 196d590a99e309764e07c9dc23ea98897eebf53a)

apt-pkg/contrib/error.cc
apt-pkg/contrib/fileutl.cc
apt-pkg/edsp.cc
test/integration/test-releasefile-verification

index 8a87e16e9e1fbdb404bfb289f936152fbaad2f07..c06ea8364992f3ebf8a4c52d7b0b2119d49b43f8 100644 (file)
@@ -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;
 }
                                                                        /*}}}*/
index b041ef131366feb56722f25dbe1b45c61ad44940..76eb6c7f0cdb6cb19745f9d21fa077d288eb1db2 100644 (file)
@@ -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;
 }
                                                                        /*}}}*/
index 38ac368311310aad78bcb9d56733dccc37aa08e1..466be3030223cb9fc840e695908f518a3ccf69bf 100644 (file)
@@ -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
index 19d5cb9bceb3afcb1e87da802a76d05deaf3318e..ebdb4d6414fdfd8189eb3808a0b6a66f872bdf05 100755 (executable)
@@ -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() {