chiark / gitweb /
btrfs-util: introduce btrfs_is_filesystem() and make use of it where appropriate
[elogind.git] / src / shared / machine-image.c
index 0b41860b5d820b5f0240c5087763da7b56fcf09b..bc215f0ad5ca60e60d8fa600c6879717c354d65c 100644 (file)
@@ -136,12 +136,11 @@ static int image_make(
 
                 /* btrfs subvolumes have inode 256 */
                 if (st.st_ino == 256) {
 
                 /* btrfs subvolumes have inode 256 */
                 if (st.st_ino == 256) {
-                        struct statfs sfs;
 
 
-                        if (fstatfs(fd, &sfs) < 0)
-                                return -errno;
-
-                        if (F_TYPE_EQUAL(sfs.f_type, BTRFS_SUPER_MAGIC)) {
+                        r = btrfs_is_filesystem(fd);
+                        if (r < 0)
+                                return r;
+                        if (r) {
                                 BtrfsSubvolInfo info;
                                 BtrfsQuotaInfo quota;
 
                                 BtrfsSubvolInfo info;
                                 BtrfsQuotaInfo quota;