From: Lennart Poettering Date: Thu, 20 May 2010 18:46:17 +0000 (+0200) Subject: socket: fix error handling X-Git-Tag: 0.git+20100605+dfd8ee-1~11^2^2~32 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6dbbe1c9860d1e1a7ca7e4be170959277f9e04d;p=systemd socket: fix error handling --- diff --git a/src/socket.c b/src/socket.c index 03d322ba..f9da353c 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;