diff options
Diffstat (limited to 'main/btrfs-progs/musl-compat.patch')
-rw-r--r-- | main/btrfs-progs/musl-compat.patch | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/main/btrfs-progs/musl-compat.patch b/main/btrfs-progs/musl-compat.patch new file mode 100644 index 0000000000..63e6220007 --- /dev/null +++ b/main/btrfs-progs/musl-compat.patch @@ -0,0 +1,23 @@ +--- a/utils.c ++++ b/utils.c +@@ -833,13 +833,19 @@ + { + int ret; + FILE *f; ++ struct stat stat_buf; + char fmt[20]; + char p[PATH_MAX]; + char real_loop_dev[PATH_MAX]; + + if (!realpath(loop_dev, real_loop_dev)) + return -errno; +- snprintf(p, PATH_MAX, "/sys/block/%s/loop/backing_file", strrchr(real_loop_dev, '/')); ++ ++ if (stat(real_loop_dev, &stat_buf) || !S_ISBLK(stat_buf.st_mode)) ++ return -errno; ++ ++ snprintf(p, PATH_MAX, "/sys/dev/block/%d:%d/loop/backing_file", ++ major(stat_buf.st_rdev), minor(stat_buf.st_rdev)); + if (!(f = fopen(p, "r"))) + return -errno; + |