]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup-generator: avoid magic value in ternary 17148/head
authorJonathan Lebon <jonathan@jlebon.com>
Wed, 23 Sep 2020 19:25:41 +0000 (15:25 -0400)
committerJonathan Lebon <jonathan@jlebon.com>
Thu, 24 Sep 2020 15:19:40 +0000 (11:19 -0400)
`startswith` already returns the string with the prefix skipped, so we
can simplify this further and avoid using a magic value.

Noticed in passing.

Co-authored-by: Lennart Poettering <lennart@poettering.net>
src/cryptsetup/cryptsetup-generator.c

index 9a1ddf2094f7b3a1dfbcd638ab4836e81ddef2a8..3ff50f4b6bce74f9d78c0e334ae989241a093a4b 100644 (file)
@@ -541,7 +541,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
                 if (proc_cmdline_value_missing(key, value))
                         return 0;
 
-                d = get_crypto_device(startswith(value, "luks-") ? value+5 : value);
+                d = get_crypto_device(startswith(value, "luks-") ?: value);
                 if (!d)
                         return log_oom();