diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-11-22 14:18:59 +0100 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-11-22 14:18:59 +0100 |
commit | 9fbdf6c92ac6e340725bf98decd63d558652c233 (patch) | |
tree | f32643b51b6b152009ea63461da5ca23372ea0c6 /lib/nl.c | |
parent | e52a09c5078364f0a645f407c797e68a2c1d5f04 (diff) | |
download | libnl-9fbdf6c92ac6e340725bf98decd63d558652c233.tar.gz |
nl_recv(): Make passing creds pointer optional
Diffstat (limited to 'lib/nl.c')
-rw-r--r-- | lib/nl.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; } } |