Changeset 92679 in vbox
- Timestamp:
- Dec 1, 2021 3:46:06 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/localipc-posix.cpp
r92678 r92679 1067 1067 struct ucred PeerCred = { (pid_t)NIL_RTPROCESS, (uid_t)NIL_RTUID, (gid_t)NIL_RTGID }; 1068 1068 socklen_t cbPeerCred = sizeof(PeerCred); 1069 if (getsockopt(RTSocketToNative(pThis->hSocket), SOL_SOCKET, SO_PEERCRED, &PeerCred, &cbPeerCred) >= 0) 1069 1070 rtLocalIpcSessionRetain(pThis); 1071 1072 int rc = RTCritSectEnter(&pThis->CritSect);; 1073 if (RT_SUCCESS(rc)) 1070 1074 { 1071 if (pProcess) 1072 *pProcess = PeerCred.pid; 1073 if (pUid) 1074 *pUid = PeerCred.uid; 1075 if (pGid) 1076 *pGid = PeerCred.gid; 1077 return VINF_SUCCESS; 1075 if (getsockopt(RTSocketToNative(pThis->hSocket), SOL_SOCKET, SO_PEERCRED, &PeerCred, &cbPeerCred) >= 0) 1076 { 1077 if (pProcess) 1078 *pProcess = PeerCred.pid; 1079 if (pUid) 1080 *pUid = PeerCred.uid; 1081 if (pGid) 1082 *pGid = PeerCred.gid; 1083 rc = VINF_SUCCESS; 1084 } 1085 else 1086 { 1087 rc = RTErrConvertFromErrno(errno); 1088 } 1089 1090 int rc2 = RTCritSectLeave(&pThis->CritSect); 1091 AssertStmt(RT_SUCCESS(rc2), rc = RT_SUCCESS(rc) ? rc2 : rc); 1078 1092 } 1079 return RTErrConvertFromErrno(errno); 1093 1094 rtLocalIpcSessionRelease(pThis); 1095 1096 return rc; 1080 1097 1081 1098 #else
Note:
See TracChangeset
for help on using the changeset viewer.