mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 07:20:11 +00:00
DARWIN: Convert crfree back into a macro
Commit1d8937b860
turned crfree on DARWIN into an inline function to work around an error flagged by clang. A side effect of this is that the address passed to kauth_cred_unref will not be the actual address of the value given to crfree; we are instead giving kauth_cred_unref the address of our function argument in order to adhere to the semantics of a function call. kauth_cred_unref seems to just take a pointer to the cred pointer in order to set the value to effectively NULL afterwards, so this is not a huge deal. However, this does mean that our current implementation undoes any of the safeguards intended by making kauth_cred_unref work this way in the first place. So, revert1d8937b860
and put the crfree definition back to the way it was. Fix the caller in afs_StoreOnLastReference to not cause an error by just assigning the cred pointer to a temporary value. While it's not ideal that some callers may need to do this, this is the only place where this is necessary and it's more of an artifact of the weirdness of storing a cred pointer in linkData, which probably should be changed anyway. Change-Id: I50557901203d22a7b19028be551eb40f0c4cd751 Reviewed-on: http://gerrit.openafs.org/10614 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
This commit is contained in:
parent
b0f433986c
commit
5c0a1d4acc
@ -105,7 +105,7 @@ enum vcexcl { EXCL, NONEXCL };
|
||||
#define crref kauth_cred_get_with_ref
|
||||
#define crhold kauth_cred_ref
|
||||
#ifdef AFS_DARWIN100_ENV
|
||||
static inline void crfree(kauth_cred_t X) { kauth_cred_unref(&X); }
|
||||
#define crfree(X) kauth_cred_unref(&X)
|
||||
#else
|
||||
#define crfree kauth_cred_rele
|
||||
#endif
|
||||
|
@ -47,6 +47,8 @@ afs_StoreOnLastReference(struct vcache *avc,
|
||||
* flag will already be clear, so we don't have to worry about
|
||||
* clearing it twice. */
|
||||
if (avc->f.states & CCore) {
|
||||
afs_ucred_t *cred;
|
||||
|
||||
avc->f.states &= ~CCore;
|
||||
#if defined(AFS_SGI_ENV)
|
||||
osi_Assert(avc->opens > 0 && avc->execsOrWriters > 0);
|
||||
@ -58,7 +60,8 @@ afs_StoreOnLastReference(struct vcache *avc,
|
||||
avc->opens--;
|
||||
avc->execsOrWriters--;
|
||||
AFS_RELE(AFSTOV(avc)); /* VN_HOLD at set CCore(afs_FakeClose) */
|
||||
crfree((afs_ucred_t *)avc->linkData); /* "crheld" in afs_FakeClose */
|
||||
cred = (afs_ucred_t *)avc->linkData; /* "crheld" in afs_FakeClose */
|
||||
crfree(cred);
|
||||
avc->linkData = NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user