From 1c3492149153ca82b18a36402f7f196f97a8512e Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 15 Feb 2013 17:12:45 +0000 Subject: [PATCH] viced: Avoid clang errors with modeBits The modeBits element of the VnodeDiskObject structure is defined as a 12 bit wide bitfield. This causes clang some problems when doing integer arithmetic, as it appears to the compiler that the field is being overflowed. For example... targetptr->disk.modeBits &= ~04000; Produces the error: implicit truncation from 'int' to bitfield changes value from -2049 to 2047 Marc Dionne suggested changing this to targetptr->disk.modeBits = targetptr->disk.modeBits & ~04000; in order to suppress the clang error. Change-Id: Iadb53a3db911f5771d3ab2437ccd43abce2a8ecb Reviewed-on: http://gerrit.openafs.org/9136 Tested-by: BuildBot Reviewed-by: Marc Dionne Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Derrick Brashear --- src/viced/afsfileprocs.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 9190133c1..b400c99cc 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -1701,9 +1701,11 @@ Update_TargetVnodeStatus(Vnode * targetptr, afs_uint32 Caller, if (Caller & TVS_SDATA) { targetptr->disk.dataVersion++; if (!remote && VanillaUser(client)) { - targetptr->disk.modeBits &= ~04000; /* turn off suid for file. */ + /* turn off suid */ + targetptr->disk.modeBits = targetptr->disk.modeBits & ~04000; #ifdef CREATE_SGUID_ADMIN_ONLY - targetptr->disk.modeBits &= ~02000; /* turn off sgid for file. */ + /* turn off sgid */ + targetptr->disk.modeBits = targetptr->disk.modeBits & ~02000; #endif } } @@ -1719,9 +1721,11 @@ Update_TargetVnodeStatus(Vnode * targetptr, afs_uint32 Caller, if (InStatus->Mask & AFS_SETOWNER) { /* admin is allowed to do chmod, chown as well as chown, chmod. */ if (!remote && VanillaUser(client)) { - targetptr->disk.modeBits &= ~04000; /* turn off suid for file. */ + /* turn off suid */ + targetptr->disk.modeBits = targetptr->disk.modeBits & ~04000; #ifdef CREATE_SGUID_ADMIN_ONLY - targetptr->disk.modeBits &= ~02000; /* turn off sgid for file. */ + /* turn off sgid */ + targetptr->disk.modeBits = targetptr->disk.modeBits & ~02000; #endif } targetptr->disk.owner = InStatus->Owner; -- 2.39.5