]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: check returned values are always initialized on success 24550/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 3 Sep 2022 15:02:38 +0000 (00:02 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 3 Sep 2022 15:02:38 +0000 (00:02 +0900)
src/test/test-bootspec.c

index 3c645a3e7998a190b0954a818cb7fbc1ffe278c1..67fa8beea91ed3e4092b836394c32b35ef438c04 100644 (file)
@@ -95,9 +95,12 @@ TEST_RET(bootspec_sort) {
 
 static void test_extract_tries_one(const char *fname, int ret, const char *stripped, unsigned tries_left, unsigned tries_done) {
         _cleanup_free_ char *p = NULL;
-        unsigned l = UINT_MAX, d = UINT_MAX;
+        unsigned l, d;
 
         assert_se(boot_filename_extract_tries(fname, &p, &l, &d) == ret);
+        if (ret < 0)
+                return;
+
         assert_se(streq_ptr(p, stripped));
         assert_se(l == tries_left);
         assert_se(d == tries_done);