When encountering suid or sgid files, we already set the `u` or `g`
property in the prototype file.
Given that proto.c only supports three numbers for permissions, we
need to remove the redundant information from the permission, else
it was incorrectly parsed.
Co-authored-by: Luca Di Maio <luca.dimaio1@gmail.com>
Co-authored-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
[aalbersh: 68 chars limit and removed patch review revisions]
else:
sgid = '-'
- perms = stat.S_IMODE(statbuf.st_mode)
+ # We already register suid in the proto string, no need
+ # to also represent it into the octet
+ perms = stat.S_IMODE(statbuf.st_mode) & 0o777
return '%s%s%s%03o %d %d' % (type, suid, sgid, perms, statbuf.st_uid, \
statbuf.st_gid)