cryptsetup: add helper for mangling "none" option strings

let's unify some code here, and let's do so in cryptsetup-util.h so that
we can later reuse this in integritysetup/veritysetup
This commit is contained in:
Lennart Poettering
2022-03-31 11:24:01 +02:00
parent dcbc38c916
commit 2fabbad898
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -1750,8 +1750,8 @@ static int run(int argc, char *argv[]) {
volume = argv[2];
source = argv[3];
key_file = argc >= 5 && !STR_IN_SET(argv[4], "", "-", "none") ? argv[4] : NULL;
options = argc >= 6 && !STR_IN_SET(argv[5], "", "-", "none") ? argv[5] : NULL;
key_file = mangle_none(argc >= 5 ? argv[4] : NULL);
options = mangle_none(argc >= 6 ? argv[5] : NULL);
if (!filename_is_valid(volume))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Volume name '%s' is not valid.", volume);