]> err.no Git - systemd/commitdiff
socket: fix error handling
authorLennart Poettering <lennart@poettering.net>
Thu, 20 May 2010 18:46:17 +0000 (20:46 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 20 May 2010 18:46:17 +0000 (20:46 +0200)
src/socket.c

index 03d322ba00e59a64c191fa3742ef7c0589fd5565..f9da353c1280a720b1f5c7f0b52db0a6b5c25339 100644 (file)
@@ -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;