cryptsetup: various coding style improvements
No functional changes.
This commit is contained in:
@@ -102,18 +102,17 @@ static int create_disk(
|
||||
if (!f)
|
||||
return log_error_errno(errno, "Failed to create unit file %s: %m", p);
|
||||
|
||||
fputs(
|
||||
"# Automatically generated by systemd-cryptsetup-generator\n\n"
|
||||
"[Unit]\n"
|
||||
"Description=Cryptography Setup for %I\n"
|
||||
"Documentation=man:crypttab(5) man:systemd-cryptsetup-generator(8) man:systemd-cryptsetup@.service(8)\n"
|
||||
"SourcePath=/etc/crypttab\n"
|
||||
"DefaultDependencies=no\n"
|
||||
"Conflicts=umount.target\n"
|
||||
"BindsTo=dev-mapper-%i.device\n"
|
||||
"IgnoreOnIsolate=true\n"
|
||||
"After=cryptsetup-pre.target\n",
|
||||
f);
|
||||
fputs("# Automatically generated by systemd-cryptsetup-generator\n\n"
|
||||
"[Unit]\n"
|
||||
"Description=Cryptography Setup for %I\n"
|
||||
"Documentation=man:crypttab(5) man:systemd-cryptsetup-generator(8) man:systemd-cryptsetup@.service(8)\n"
|
||||
"SourcePath=/etc/crypttab\n"
|
||||
"DefaultDependencies=no\n"
|
||||
"Conflicts=umount.target\n"
|
||||
"BindsTo=dev-mapper-%i.device\n"
|
||||
"IgnoreOnIsolate=true\n"
|
||||
"After=cryptsetup-pre.target\n",
|
||||
f);
|
||||
|
||||
if (!nofail)
|
||||
fprintf(f,
|
||||
@@ -357,7 +356,6 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
||||
uuid_value = NULL;
|
||||
} else
|
||||
log_warning("Failed to parse luks name switch %s. Ignoring.", value);
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -466,7 +464,7 @@ static int add_proc_cmdline_devices(void) {
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int r = EXIT_FAILURE;
|
||||
int r;
|
||||
|
||||
if (argc > 1 && argc != 4) {
|
||||
log_error("This program takes three or no arguments.");
|
||||
@@ -483,32 +481,36 @@ int main(int argc, char *argv[]) {
|
||||
umask(0022);
|
||||
|
||||
arg_disks = hashmap_new(&string_hash_ops);
|
||||
if (!arg_disks)
|
||||
goto cleanup;
|
||||
if (!arg_disks) {
|
||||
r = log_oom();
|
||||
goto finish;
|
||||
}
|
||||
|
||||
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX);
|
||||
if (r < 0) {
|
||||
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
|
||||
r = EXIT_FAILURE;
|
||||
log_warning_errno(r, "Failed to parse kernel command line: %m");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (!arg_enabled) {
|
||||
r = EXIT_SUCCESS;
|
||||
goto cleanup;
|
||||
r = 0;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (add_crypttab_devices() < 0)
|
||||
goto cleanup;
|
||||
r = add_crypttab_devices();
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
|
||||
if (add_proc_cmdline_devices() < 0)
|
||||
goto cleanup;
|
||||
r = add_proc_cmdline_devices();
|
||||
if (r < 0)
|
||||
goto finish;
|
||||
|
||||
r = EXIT_SUCCESS;
|
||||
r = 0;
|
||||
|
||||
cleanup:
|
||||
finish:
|
||||
free_arg_disks();
|
||||
free(arg_default_options);
|
||||
free(arg_default_keyfile);
|
||||
|
||||
return r;
|
||||
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user