summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/dtch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/dtch.c b/bin/dtch.c
index 4714f748..5b920a31 100644
--- a/bin/dtch.c
+++ b/bin/dtch.c
@@ -99,8 +99,10 @@ static int recvFd(int sock) {
     if (n < 0) return -1;
 
     struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg);
-    if (!cmsg) { errno = ENOMSG; return -1; }
-    if (cmsg->cmsg_type != SCM_RIGHTS) { errno = EBADMSG; return -1; }
+    if (!cmsg || cmsg->cmsg_type != SCM_RIGHTS) {
+        errno = ENOMSG;
+        return -1;
+    }
 
     return *(int *)CMSG_DATA(cmsg);
 }