chiark / gitweb /
resolve: fix compilation on LLVM+clang
[elogind.git] / src / resolve / resolved-dns-stream.c
index 47130c4231923a42219e73358b3f602e678e8b67..8b3a3ced4b7724341736a8928a70afb2f7910da8 100644 (file)
@@ -64,7 +64,7 @@ static int dns_stream_complete(DnsStream *s, int error) {
 static int dns_stream_identify(DnsStream *s) {
         union {
                 struct cmsghdr header; /* For alignment */
-                uint8_t buffer[CMSG_SPACE(MAX(sizeof(struct in_pktinfo), sizeof(struct in6_pktinfo)))
+                uint8_t buffer[CMSG_SPACE(CONST_MAX(sizeof(struct in_pktinfo), sizeof(struct in6_pktinfo)))
                                + EXTRA_CMSG_SPACE /* kernel appears to require extra space */];
         } control;
         struct msghdr mh = {};
@@ -172,11 +172,11 @@ static int dns_stream_identify(DnsStream *s) {
                 if (s->local.sa.sa_family == AF_INET) {
                         r = setsockopt(s->fd, IPPROTO_IP, IP_UNICAST_IF, &ifindex, sizeof(ifindex));
                         if (r < 0)
-                                return -errno;
+                                log_debug("Failed to invoke IP_UNICAST_IF: %m");
                 } else if (s->local.sa.sa_family == AF_INET6) {
                         r = setsockopt(s->fd, IPPROTO_IPV6, IPV6_UNICAST_IF, &ifindex, sizeof(ifindex));
                         if (r < 0)
-                                return -errno;
+                                log_debug("Failed to invoke IPV6_UNICAST_IF: %m");
                 }
         }
 
@@ -368,7 +368,12 @@ int dns_stream_new(Manager *m, DnsStream **ret, DnsProtocol protocol, int fd) {
         if (r < 0)
                 return r;
 
-        r = sd_event_add_time(m->event, &s->timeout_event_source, CLOCK_MONOTONIC, now(CLOCK_MONOTONIC) + DNS_STREAM_TIMEOUT_USEC, 0, on_stream_timeout, s);
+        r = sd_event_add_time(
+                        m->event,
+                        &s->timeout_event_source,
+                        clock_boottime_or_monotonic(),
+                        now(clock_boottime_or_monotonic()) + DNS_STREAM_TIMEOUT_USEC, 0,
+                        on_stream_timeout, s);
         if (r < 0)
                 return r;