]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: remove always-true superflous check and rename label
authorLuca Boccassi <luca.boccassi@gmail.com>
Fri, 1 Nov 2024 13:51:57 +0000 (13:51 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 1 Nov 2024 15:44:01 +0000 (15:44 +0000)
Fixes https://github.com/systemd/systemd/security/code-scanning/2900

src/resolve/resolved-varlink.c

index 13b0686244d356cbfa4f877e7eefd7ac6fcbf9ad..168923e6b54b5b6ba193520f2f277e52fcbe8dc7 100644 (file)
@@ -912,7 +912,7 @@ static void vl_method_resolve_service_complete(DnsQuery *query) {
         if (r == -ELOOP)
                 return (void) sd_varlink_error(q->varlink_request, "io.systemd.Resolve.CNAMELoop", NULL);
         if (r < 0)
-                goto finish;
+                goto fail;
         if (r == DNS_QUERY_CNAME) {
                 /* This was a cname, and the query was restarted. */
                 TAKE_PTR(q);
@@ -924,7 +924,7 @@ static void vl_method_resolve_service_complete(DnsQuery *query) {
         DNS_ANSWER_FOREACH_IFINDEX(rr, ifindex, q->answer) {
                 r = dns_question_matches_rr(question, rr, NULL);
                 if (r < 0)
-                        goto finish;
+                        goto fail;
                 if (r == 0)
                         continue;
 
@@ -942,7 +942,7 @@ static void vl_method_resolve_service_complete(DnsQuery *query) {
                         q->block_all_complete--;
 
                         if (r < 0)
-                                goto finish;
+                                goto fail;
                 }
 
                 found++;
@@ -961,11 +961,9 @@ static void vl_method_resolve_service_complete(DnsQuery *query) {
         resolve_service_all_complete(TAKE_PTR(q));
         return;
 
-finish:
-        if (r < 0) {
-                log_error_errno(r, "Failed to send address reply: %m");
-                (void) sd_varlink_error_errno(q->varlink_request, r);
-        }
+fail:
+        log_error_errno(r, "Failed to send address reply: %m");
+        (void) sd_varlink_error_errno(q->varlink_request, r);
 }
 
 static int vl_method_resolve_service(sd_varlink* link, sd_json_variant* parameters, sd_varlink_method_flags_t flags, void* userdata) {