diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-17 16:20:38 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-17 16:48:21 +0200 |
commit | 1a37c9756f0c55917192e1a229977734b1f7ea45 (patch) | |
tree | 27d1d77cd12a25bb8c211a8af8998d8448ef17c1 /src/bus-proxyd/bus-proxyd.c | |
parent | 3f952f92b9f401fbe4c4876541ca145a551df039 (diff) |
bus-proxy: don't close local bus fds twice
Clear up how we pass fd owner ship to proxy and bus objects. Document
that ownership is passed of the fds in question even in case of failing
constructors, and that callers should forget about fds pass into the
proxy object.
The alternative would be to duplicate the fds, but given that fds are a
relatively scarce and heavy resource let's better avoid that.
Fixes #1591.
Diffstat (limited to 'src/bus-proxyd/bus-proxyd.c')
-rw-r--r-- | src/bus-proxyd/bus-proxyd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c index 2bc265d9b4..6a4da0f2e2 100644 --- a/src/bus-proxyd/bus-proxyd.c +++ b/src/bus-proxyd/bus-proxyd.c @@ -85,11 +85,11 @@ static void *run_client(void *userdata) { int r; r = proxy_new(&p, c->fd, c->fd, arg_address); + c->fd = -1; + if (r < 0) goto exit; - c->fd = -1; - /* set comm to "p$PIDu$UID" and suffix with '*' if truncated */ r = snprintf(comm, sizeof(comm), "p" PID_FMT "u" UID_FMT, p->local_creds.pid, p->local_creds.uid); if (r >= (ssize_t)sizeof(comm)) |