chiark / gitweb /
bus: when we unmarshal an fd it should stay owned by the message object
[elogind.git] / src / libsystemd-bus / bus-message.c
index fb63a2d1cf34b6bffda27b54dd372cc51d917f3f..3081664091af23e6629793efe057f1a00c644ff1 100644 (file)
@@ -1710,18 +1710,13 @@ int sd_bus_message_read_basic(sd_bus_message *m, char type, void *p) {
                         break;
 
                 case SD_BUS_TYPE_UNIX_FD: {
-                        int copy;
                         uint32_t j;
 
                         j = BUS_MESSAGE_BSWAP32(m, *(uint32_t*) q);
                         if (j >= m->n_fds)
                                 return -EBADMSG;
 
-                        copy = fcntl(m->fds[j], F_DUPFD_CLOEXEC, 3);
-                        if (copy < 0)
-                                return -errno;
-
-                        *(int*) p = copy;
+                        *(int*) p = m->fds[j];
                         break;
                 }