Return empty on failure to get context

This commit is contained in:
vvb2060 2022-06-01 04:11:33 +08:00 committed by John Wu
parent 3219d945f5
commit d7776f6597

View File

@ -27,7 +27,7 @@ bool get_client_cred(int fd, sock_cred *cred) {
char buf[4096];
len = sizeof(buf);
if (getsockopt(fd, SOL_SOCKET, SO_PEERSEC, buf, &len) != 0)
return false;
len = 0;
buf[len] = '\0';
cred->context = buf;
return true;