]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_protofile: fix device number encoding
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:40:55 +0000 (14:40 -0800)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 5 Feb 2025 17:20:02 +0000 (18:20 +0100)
Actually crack major/minor device numbers from the stat results that we
get when we encounter a character/block device file.

Fixes: 6aace700b7b82d ("mkfs: add a utility to generate protofiles")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
mkfs/xfs_protofile.in

index 356d3d80b3252178fa81048b56f93655b1bca2ca..e83c39f5325846f677133f57759c2729578b032b 100644 (file)
@@ -54,7 +54,7 @@ def stat_to_extra(statbuf, fullpath):
        if stat.S_ISREG(statbuf.st_mode):
                return ' %s' % fullpath
        elif stat.S_ISCHR(statbuf.st_mode) or stat.S_ISBLK(statbuf.st_mode):
-               return ' %d %d' % (statbuf.st_rdev, statbuf.st_rdev)
+               return ' %d %d' % (os.major(statbuf.st_rdev), os.minor(statbuf.st_rdev))
        elif stat.S_ISLNK(statbuf.st_mode):
                return ' %s' % os.readlink(fullpath)
        return ''