summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-11-22 14:18:59 +0100
committerThomas Graf <tgraf@suug.ch>2010-11-22 14:18:59 +0100
commit9fbdf6c92ac6e340725bf98decd63d558652c233 (patch)
treef32643b51b6b152009ea63461da5ca23372ea0c6
parente52a09c5078364f0a645f407c797e68a2c1d5f04 (diff)
downloadlibnl-9fbdf6c92ac6e340725bf98decd63d558652c233.tar.gz
nl_recv(): Make passing creds pointer optional
-rw-r--r--lib/nl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/nl.c b/lib/nl.c
index 97a5df0..5616dcc 100644
--- a/lib/nl.c
+++ b/lib/nl.c
@@ -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;
}
}