From: Darrick J. Wong Date: Mon, 3 Feb 2025 22:40:55 +0000 (-0800) Subject: xfs_protofile: fix device number encoding X-Git-Tag: v6.13.0~1 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=eff7226942a59fc78e8ecd7577657c30ed0cf9a8;p=thirdparty%2Fxfsprogs-dev.git xfs_protofile: fix device number encoding 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 Reviewed-by: Christoph Hellwig --- diff --git a/mkfs/xfs_protofile.in b/mkfs/xfs_protofile.in index 356d3d80..e83c39f5 100644 --- a/mkfs/xfs_protofile.in +++ b/mkfs/xfs_protofile.in @@ -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 ''