]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: fix abort when recv() returns 0
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 12 Sep 2019 12:52:08 +0000 (14:52 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 13 Sep 2019 04:31:43 +0000 (13:31 +0900)
https://bugzilla.redhat.com/show_bug.cgi?id=1703598

src/resolve/resolved-dns-transaction.c

index 262f63cae3c9587189959c484dd8b61e809cc3c6..fb54d160da4fa754f751b0b25a2d5e4ecbe7412b 100644 (file)
@@ -1183,8 +1183,8 @@ static int on_dns_packet(sd_event_source *s, int fd, uint32_t revents, void *use
         if (ERRNO_IS_DISCONNECT(-r)) {
                 usec_t usec;
 
-                /* UDP connection failure get reported via ICMP and then are possible delivered to us on the next
-                 * recvmsg(). Treat this like a lost packet. */
+                /* UDP connection failures get reported via ICMP and then are possibly delivered to us on the
+                 * next recvmsg(). Treat this like a lost packet. */
 
                 log_debug_errno(r, "Connection failure for DNS UDP packet: %m");
                 assert_se(sd_event_now(t->scope->manager->event, clock_boottime_or_monotonic(), &usec) >= 0);
@@ -1198,6 +1198,9 @@ static int on_dns_packet(sd_event_source *s, int fd, uint32_t revents, void *use
                 t->answer_errno = -r;
                 return 0;
         }
+        if (r == 0)
+                /* Spurious wakeup without any data */
+                return 0;
 
         r = dns_packet_validate_reply(p);
         if (r < 0) {