]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/bootspec.c
Add a helper for /dev/block/major:minor paths
[thirdparty/systemd.git] / src / shared / bootspec.c
index 9f80db068de1792de184956bf7637a508b8e0e7e..aa722c304a08fe1b60e467db30bf55078ebb6286 100644 (file)
@@ -25,6 +25,7 @@
 #include "bootspec.h"
 #include "conf-files.h"
 #include "def.h"
+#include "device-nodes.h"
 #include "efivars.h"
 #include "fd-util.h"
 #include "fileio.h"
@@ -420,7 +421,7 @@ static int verify_esp(
                 sd_id128_t *ret_uuid) {
 
         _cleanup_blkid_free_probe_ blkid_probe b = NULL;
-        _cleanup_free_ char *t = NULL;
+        char t[DEV_NUM_PATH_MAX];
         uint64_t pstart = 0, psize = 0;
         struct stat st, st2;
         const char *v, *t2;
@@ -478,10 +479,7 @@ static int verify_esp(
         if (detect_container() > 0 || geteuid() != 0)
                 goto finish;
 
-        r = asprintf(&t, "/dev/block/%u:%u", major(st.st_dev), minor(st.st_dev));
-        if (r < 0)
-                return log_oom();
-
+        xsprintf_dev_num_path(t, "block", st.st_dev);
         errno = 0;
         b = blkid_new_probe_from_filename(t);
         if (!b)