From: Oliver Kurth Date: Fri, 26 Oct 2018 17:44:55 +0000 (-0700) Subject: Common source file change not applicable to open-vm-tools X-Git-Tag: stable-11.0.0~391 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e05fcb7f92256b6f878c05792e4e9c933854500;p=thirdparty%2Fopen-vm-tools.git Common source file change not applicable to open-vm-tools --- diff --git a/open-vm-tools/lib/misc/idLinux.c b/open-vm-tools/lib/misc/idLinux.c index 1e5f6b792..a3cc0ea96 100644 --- a/open-vm-tools/lib/misc/idLinux.c +++ b/open-vm-tools/lib/misc/idLinux.c @@ -602,19 +602,21 @@ IdAuthCreateWithFork(void) VERIFY(result == child); } else { // Child: use fds[1] + OSStatus ret; - data.success = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, - kAuthorizationFlagDefaults, &auth) - == errAuthorizationSuccess; + ret = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, + kAuthorizationFlagDefaults, &auth); + data.success = ret == errAuthorizationSuccess; if (data.success) { - data.success = AuthorizationMakeExternalForm(auth, &data.ext) - == errAuthorizationSuccess; + ret = AuthorizationMakeExternalForm(auth, &data.ext); + data.success = ret == errAuthorizationSuccess; if (!data.success) { - Warning("%s: child AuthorizationMakeExternalForm() failed.\n", - __func__); + Warning("%s: child AuthorizationMakeExternalForm() failed: %d.\n", + __func__, (int32)ret); } } else { - Warning("%s: child AuthorizationCreate() failed.\n", __func__); + Warning("%s: child AuthorizationCreate() failed: %d.\n", + __func__, (int32)ret); } // Tell the parent it can now create a process ref to the auth session. @@ -675,6 +677,8 @@ static Atomic_Ptr procAuth = { 0 }; static AuthorizationRef IdAuthGet(void) { + AuthorizationRef authRef; + if (UNLIKELY(Atomic_ReadPtr(&procAuth) == NULL)) { AuthorizationRef newProcAuth = IdAuthCreate(); @@ -684,9 +688,12 @@ IdAuthGet(void) } } - ASSERT(Atomic_ReadPtr(&procAuth) != NULL); + authRef = Atomic_ReadPtr(&procAuth); + if (authRef == NULL) { + Log("%s: Failed to obtain an AuthorizationRef.\n", __func__); + } - return Atomic_ReadPtr(&procAuth); + return authRef; }