cryptsetup-generator: use log_oom() everywhere

This commit is contained in:
Michal Schmidt 2012-11-23 14:16:34 +01:00
parent a24d03b8ee
commit 74576bea7a

View file

@ -83,29 +83,25 @@ static int create_disk(
n = unit_name_from_path_instance("systemd-cryptsetup", name, ".service"); n = unit_name_from_path_instance("systemd-cryptsetup", name, ".service");
if (!n) { if (!n) {
r = -ENOMEM; r = log_oom();
log_error("Failed to allocate unit name.");
goto fail; goto fail;
} }
p = strjoin(arg_dest, "/", n, NULL); p = strjoin(arg_dest, "/", n, NULL);
if (!p) { if (!p) {
r = -ENOMEM; r = log_oom();
log_error("Failed to allocate unit file name.");
goto fail; goto fail;
} }
u = fstab_node_to_udev_node(device); u = fstab_node_to_udev_node(device);
if (!u) { if (!u) {
r = -ENOMEM; r = log_oom();
log_error("Failed to allocate device node.");
goto fail; goto fail;
} }
d = unit_name_from_path(u, ".device"); d = unit_name_from_path(u, ".device");
if (!d) { if (!d) {
r = -ENOMEM; r = log_oom();
log_error("Failed to allocate device name.");
goto fail; goto fail;
} }
@ -169,7 +165,7 @@ static int create_disk(
} }
if (asprintf(&from, "../%s", n) < 0) { if (asprintf(&from, "../%s", n) < 0) {
r = -ENOMEM; r = log_oom();
goto fail; goto fail;
} }
@ -177,7 +173,7 @@ static int create_disk(
to = strjoin(arg_dest, "/", d, ".wants/", n, NULL); to = strjoin(arg_dest, "/", d, ".wants/", n, NULL);
if (!to) { if (!to) {
r = -ENOMEM; r = log_oom();
goto fail; goto fail;
} }
@ -195,7 +191,7 @@ static int create_disk(
else else
to = strjoin(arg_dest, "/cryptsetup.target.wants/", n, NULL); to = strjoin(arg_dest, "/cryptsetup.target.wants/", n, NULL);
if (!to) { if (!to) {
r = -ENOMEM; r = log_oom();
goto fail; goto fail;
} }
@ -213,7 +209,7 @@ static int create_disk(
e = unit_name_escape(name); e = unit_name_escape(name);
to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL); to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL);
if (!to) { if (!to) {
r = -ENOMEM; r = log_oom();
goto fail; goto fail;
} }
@ -260,7 +256,7 @@ static int parse_proc_cmdline(void) {
word = strndup(w, l); word = strndup(w, l);
if (!word) { if (!word) {
r = -ENOMEM; r = log_oom();
goto finish; goto finish;
} }