summaryrefslogtreecommitdiffstats
path: root/src/dissect
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-04-12 15:38:01 +0200
committerLennart Poettering <lennart@poettering.net>2023-04-13 11:17:28 +0200
commit06e78680e3c36589b785f90ecda64d124905a3f7 (patch)
tree4e30e25ea6b5d15e3156ec783cfef15744df9b27 /src/dissect
parentrepart: Discard from/to first/last usable lba (diff)
downloadsystemd-06e78680e3c36589b785f90ecda64d124905a3f7.tar.xz
systemd-06e78680e3c36589b785f90ecda64d124905a3f7.zip
image-policy: introduce parse_image_policy_argument() helper
Addresses https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1060130312, https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1067927293, and https://github.com/systemd/systemd/pull/25608/commits/84be0c710d9d562f6d2cf986cc2a8ff4c98a138b#r1067926416. Follow-up for 84be0c710d9d562f6d2cf986cc2a8ff4c98a138b.
Diffstat (limited to 'src/dissect')
-rw-r--r--src/dissect/dissect.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c
index b53c2cc357..ab9d796cf4 100644
--- a/src/dissect/dissect.c
+++ b/src/dissect/dissect.c
@@ -466,17 +466,11 @@ static int parse_argv(int argc, char *argv[]) {
return r;
break;
- case ARG_IMAGE_POLICY: {
- _cleanup_(image_policy_freep) ImagePolicy *p = NULL;
-
- r = image_policy_from_string(optarg, &p);
+ case ARG_IMAGE_POLICY:
+ r = parse_image_policy_argument(optarg, &arg_image_policy);
if (r < 0)
- return log_error_errno(r, "Failed to parse image policy: %s", optarg);
-
- image_policy_free(arg_image_policy);
- arg_image_policy = TAKE_PTR(p);
+ return r;
break;
- }
case ARG_VALIDATE:
arg_action = ACTION_VALIDATE;