diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-05-20 20:46:17 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-05-20 20:46:17 +0200 |
commit | b6dbbe1c9860d1e1a7ca7e4be170959277f9e04d (patch) | |
tree | 33bb98cb60df52ed13cdfc0e54babeca2083f1a5 /src | |
parent | 2b061f5a4b4e8927c7c1077e494455a189e34d59 (diff) |
socket: fix error handling
Diffstat (limited to 'src')
-rw-r--r-- | src/socket.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/socket.c b/src/socket.c index 03d322ba00..f9da353c12 100644 --- a/src/socket.c +++ b/src/socket.c @@ -896,7 +896,7 @@ static void socket_enter_running(Socket *s, int cfd) { Unit *u; char *prefix, *instance, *name; - if ((r = instance_from_socket(cfd, s->n_accepted++, &instance))) + if ((r = instance_from_socket(cfd, s->n_accepted++, &instance)) < 0) goto fail; if (!(prefix = unit_name_to_prefix(UNIT(s)->meta.id))) { @@ -909,8 +909,10 @@ static void socket_enter_running(Socket *s, int cfd) { free(prefix); free(instance); - if (!name) + if (!name) { r = -ENOMEM; + goto fail; + } r = manager_load_unit(UNIT(s)->meta.manager, name, NULL, &u); free(name); @@ -918,7 +920,7 @@ static void socket_enter_running(Socket *s, int cfd) { if (r < 0) goto fail; - if ((r = service_set_socket_fd(SERVICE(u), cfd) < 0)) + if ((r = service_set_socket_fd(SERVICE(u), cfd)) < 0) goto fail; cfd = -1; |