if (r < 0)
return r;
- /* clear the setuid/setgid bits, if any */
- if (unlikely(in->mode & (S_ISUID|S_ISGID)) && size > 0) {
- struct ceph_statx stx = { 0 };
-
- put_cap_ref(in, CEPH_CAP_AUTH_SHARED);
- r = __setattrx(in, &stx, CEPH_SETATTR_KILL_SGUID, f->actor_perms);
+ put_cap_ref(in, CEPH_CAP_AUTH_SHARED);
+ if (size > 0) {
+ r = clear_suid_sgid(in, f->actor_perms);
if (r < 0) {
put_cap_ref(in, CEPH_CAP_FILE_WR);
return r;
}
- } else {
- put_cap_ref(in, CEPH_CAP_AUTH_SHARED);
}
if (f->flags & O_DIRECT)