diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-04-10 23:04:20 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-04-10 23:23:19 +0200 |
commit | 1ef2af5ae02aede39262dedd9fd358b607450662 (patch) | |
tree | 4842912c9e8fc8d2b515237b2ebd2d07560d22fd /src/libsystemd-bus/bus-message.c | |
parent | 50fb97935d689a520251b2d543599be14bdfd0ed (diff) |
bus: when we unmarshal an fd it should stay owned by the message object
If the user wants the fd to stay valid he should keep a reference to the
message object or duplicate the fd.
This unifies behaviour of demarshalling data fields and unix fds.
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r-- | src/libsystemd-bus/bus-message.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index fb63a2d1cf..3081664091 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -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; } |