dect
/
libnl
Archived
13
0
Fork 0

nl_recv(): Make passing creds pointer optional

This commit is contained in:
Thomas Graf 2010-11-22 14:18:59 +01:00
parent e52a09c507
commit 9fbdf6c92a
1 changed files with 4 additions and 2 deletions

View File

@ -485,8 +485,10 @@ retry:
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (cmsg->cmsg_level == SOL_SOCKET &&
cmsg->cmsg_type == SCM_CREDENTIALS) {
*creds = calloc(1, sizeof(struct ucred));
memcpy(*creds, CMSG_DATA(cmsg), sizeof(struct ucred));
if (creds) {
*creds = calloc(1, sizeof(struct ucred));
memcpy(*creds, CMSG_DATA(cmsg), sizeof(struct ucred));
}
break;
}
}