[systemd-commits] 2 commits - src/cryptsetup

Michal Schmidt michich at kemper.freedesktop.org
Fri Nov 23 05:19:37 PST 2012


 src/cryptsetup/cryptsetup-generator.c |   26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 1cda32b8a29750720872d3525084ac67b88e066f
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Fri Nov 23 14:16:39 2012 +0100

    cryptsetup-generator: state file name in error messages

diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index ef16fbc..6e7b707 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -108,7 +108,7 @@ static int create_disk(
         f = fopen(p, "wxe");
         if (!f) {
                 r = -errno;
-                log_error("Failed to create unit file: %m");
+                log_error("Failed to create unit file %s: %m", p);
                 goto fail;
         }
 
@@ -160,7 +160,7 @@ static int create_disk(
 
         if (ferror(f)) {
                 r = -errno;
-                log_error("Failed to write file: %m");
+                log_error("Failed to write file %s: %m", p);
                 goto fail;
         }
 

commit 74576bea7a50740f1aec423bac5e20f8ca7a8592
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Fri Nov 23 14:16:34 2012 +0100

    cryptsetup-generator: use log_oom() everywhere

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



More information about the systemd-commits mailing list