]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Don't fail on missing verity sig partition
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 2 Oct 2022 08:51:53 +0000 (10:51 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 2 Oct 2022 13:08:34 +0000 (14:08 +0100)
Also, provide a proper error message when we fail to find a verity
sibling partition.

src/partition/repart.c

index 0bd19523ecfb3e1a07ad5bfaf8217cddea22e2fe..471537d6534db2793e15b0a6bdb6fb0caf35195e 100644 (file)
@@ -1705,16 +1705,19 @@ static int context_read_definitions(
                                 continue;
 
                         r = find_verity_sibling(context, p, mode, &q);
-                        if (mode != VERITY_SIG && r == -ENXIO)
-                                return log_syntax(NULL, LOG_ERR, p->definition_path, 1, SYNTHETIC_ERRNO(EINVAL),
-                                                  "Missing verity %s partition for verity %s partition with VerityMatchKey=%s",
-                                                  verity_mode_to_string(mode), verity_mode_to_string(p->verity), p->verity_match_key);
-                        if (r == -ENOTUNIQ)
+                        if (r == -ENXIO) {
+                                if (mode != VERITY_SIG)
+                                        return log_syntax(NULL, LOG_ERR, p->definition_path, 1, SYNTHETIC_ERRNO(EINVAL),
+                                                          "Missing verity %s partition for verity %s partition with VerityMatchKey=%s",
+                                                          verity_mode_to_string(mode), verity_mode_to_string(p->verity), p->verity_match_key);
+                        } else if (r == -ENOTUNIQ)
                                 return log_syntax(NULL, LOG_ERR, p->definition_path, 1, SYNTHETIC_ERRNO(EINVAL),
                                                   "Multiple verity %s partitions found for verity %s partition with VerityMatchKey=%s",
                                                   verity_mode_to_string(mode), verity_mode_to_string(p->verity), p->verity_match_key);
-                        if (r < 0)
-                                return r;
+                        else if (r < 0)
+                                return log_syntax(NULL, LOG_ERR, p->definition_path, 1, r,
+                                                  "Failed to find verity %s partition for verity %s partition with VerityMatchKey=%s",
+                                                  verity_mode_to_string(mode), verity_mode_to_string(p->verity), p->verity_match_key);
 
                         if (q) {
                                 if (q->priority != p->priority)