--- a/src/setup/setup.c
|
|
+++ b/src/setup/setup.c
|
|
@@ -83,6 +83,9 @@ static int verify_esp(const char *p, uin
|
|
blkid_probe b = NULL;
|
|
int r;
|
|
const char *v;
|
|
+ char buf[1024];
|
|
+
|
|
+ memset(buf, 0, sizeof(buf));
|
|
|
|
if (statfs(p, &sfs) < 0) {
|
|
fprintf(stderr, "Failed to check file system type of %s: %m\n", p);
|
|
@@ -122,24 +125,38 @@ static int verify_esp(const char *p, uin
|
|
return -ENODEV;
|
|
}
|
|
|
|
- r = asprintf(&t, "/dev/block/%u:%u", major(st.st_dev), minor(st.st_dev));
|
|
+ r = asprintf(&t, "/sys/dev/block/%u:%u", major(st.st_dev), minor(st.st_dev));
|
|
if (r < 0) {
|
|
fprintf(stderr, "Out of memory.\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
+ r = readlink(t, buf, sizeof(buf) - 1);
|
|
+ if (r < 0) {
|
|
+ fprintf(stderr, "Failed to identify device node for block device %u:%u\n", major(st.st_dev), minor(st.st_dev));
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
+ r = asprintf(&t, "/dev/%s", basename(buf));
|
|
+ if (r < 0) {
|
|
+ fprintf(stderr, "Out of memory.\n");
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
errno = 0;
|
|
b = blkid_new_probe_from_filename(t);
|
|
- free(t);
|
|
if (!b) {
|
|
if (errno != 0) {
|
|
- fprintf(stderr, "Failed to open file system %s: %m\n", p);
|
|
+ fprintf(stderr, "Failed to open file system %s on %s: %m\n", p, t);
|
|
+ free(t);
|
|
return -errno;
|
|
}
|
|
|
|
+ free(t);
|
|
fprintf(stderr, "Out of memory.\n");
|
|
return -ENOMEM;
|
|
}
|
|
+ free(t);
|
|
|
|
blkid_probe_enable_superblocks(b, 1);
|
|
blkid_probe_set_superblocks_flags(b, BLKID_SUBLKS_TYPE);
|