chiark / gitweb /
gpt-auto-generator: don't return OOM on parentless devices
[elogind.git] / src / gpt-auto-generator / gpt-auto-generator.c
index 67d0f2a5b902603ed255a44dc050403a9c46739a..19c5eea9de2fc24a5a97cb3589d77d08f20d39c7 100644 (file)
 #include "gpt.h"
 #include "fileio.h"
 #include "efivars.h"
+#include "blkid-util.h"
 
 static const char *arg_dest = "/tmp";
 static bool arg_enabled = true;
 static bool arg_root_enabled = true;
 static bool arg_root_rw = false;
 
-DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe);
-#define _cleanup_blkid_free_probe_ _cleanup_(blkid_free_probep)
-
 static int add_swap(const char *path) {
         _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL;
         _cleanup_fclose_ FILE *f = NULL;
@@ -397,7 +395,7 @@ static int enumerate_partitions(dev_t devnum) {
 
         parent = udev_device_get_parent(d);
         if (!parent)
-                return log_oom();
+                return 0;
 
         /* Does it have a devtype? */
         devtype = udev_device_get_devtype(parent);
@@ -464,7 +462,7 @@ static int enumerate_partitions(dev_t devnum) {
                 if (errno == 0)
                         return log_oom();
 
-                log_error("Failed to list of partitions of %s: %m", node);
+                log_error("Failed to list partitions of %s: %m", node);
                 return -errno;
         }
 
@@ -704,7 +702,7 @@ static int add_root_mount(void) {
 
         return add_mount(
                         "root",
-                        "/dev/disk/by-id/gpt-auto-root",
+                        "/dev/gpt-auto-root",
                         in_initrd() ? "/sysroot" : "/",
                         NULL,
                         arg_root_rw ? "rw" : "ro",