diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-04-28 17:09:50 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-04-29 16:27:48 +0200 |
commit | 3e7a1f50e473a374e1657d2051237e2db04c4db2 (patch) | |
tree | 1a0fe54ae73af26c0c809672163c558425d5ef6b /src/core/socket.c | |
parent | 7f2fbbff06519a486a37ad140ea9200513d42747 (diff) |
core: make sure to close connection fd when we fail to activate a per-connection service
Fixes: #2993 #2691
Diffstat (limited to 'src/core/socket.c')
-rw-r--r-- | src/core/socket.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index 42260d8729..a897a11a29 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -2010,8 +2010,12 @@ static void socket_enter_running(Socket *s, int cfd) { s->n_connections++; r = manager_add_job(UNIT(s)->manager, JOB_START, UNIT(service), JOB_REPLACE, &error, NULL); - if (r < 0) + if (r < 0) { + /* We failed to activate the new service, but it still exists. Let's make sure the service + * closes and forgets the connection fd again, immediately. */ + service_close_socket_fd(service); goto fail; + } /* Notify clients about changed counters */ unit_add_to_dbus_queue(UNIT(s)); |