Add a helper for /dev/block/major:minor paths

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-11-30 12:59:23 +01:00
parent 553e15f21b
commit c67f84b025
3 changed files with 17 additions and 15 deletions
+3 -5
View 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)