diff mbox series

[2/3] xfs_protofile: fix mode formatting error

Message ID 173862239063.2460098.16773056715229696499.stgit@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series [1/3] mkfs: fix file size setting when interpreting a protofile | expand

Commit Message

Darrick J. Wong Feb. 3, 2025, 10:40 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

The protofile parser expects the mode to be specified with three octal
digits.  Unfortunately, the generator doesn't get that right if the mode
doesn't have any of bits 8-11 (aka no owner access privileges) set.

Fixes: 6aace700b7b82d ("mkfs: add a utility to generate protofiles")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 mkfs/xfs_protofile.in |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Feb. 4, 2025, 4:53 a.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/mkfs/xfs_protofile.in b/mkfs/xfs_protofile.in
index 9aee4336888523..356d3d80b32521 100644
--- a/mkfs/xfs_protofile.in
+++ b/mkfs/xfs_protofile.in
@@ -45,7 +45,7 @@  def stat_to_str(statbuf):
 
 	perms = stat.S_IMODE(statbuf.st_mode)
 
-	return '%s%s%s%o %d %d' % (type, suid, sgid, perms, statbuf.st_uid, \
+	return '%s%s%s%03o %d %d' % (type, suid, sgid, perms, statbuf.st_uid, \
 			statbuf.st_gid)
 
 def stat_to_extra(statbuf, fullpath):