Merge pull request #17273 from mrc0mmand/coccinelle-check-for-bad-errno
coccinelle: resolve our own macros to avoid skipping functions
This commit is contained in:
+14
-16
@@ -261,10 +261,9 @@ static int resolve_host(sd_bus *bus, const char *name) {
|
||||
(int) strlen(name), c == 0 ? name : "", c == 0 ? ":" : " ",
|
||||
canonical);
|
||||
|
||||
if (c == 0) {
|
||||
log_error("%s: no addresses found", name);
|
||||
return -ESRCH;
|
||||
}
|
||||
if (c == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ESRCH),
|
||||
"%s: no addresses found", name);
|
||||
|
||||
print_source(flags, ts);
|
||||
|
||||
@@ -356,10 +355,9 @@ static int resolve_address(sd_bus *bus, int family, const union in_addr_union *a
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
if (c == 0) {
|
||||
log_error("%s: no names found", pretty);
|
||||
return -ESRCH;
|
||||
}
|
||||
if (c == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(ESRCH),
|
||||
"%s: no names found", pretty);
|
||||
|
||||
print_source(flags, ts);
|
||||
|
||||
@@ -2050,10 +2048,10 @@ static int call_domain(sd_bus *bus, char **domain, const BusLocator *locator, sd
|
||||
r = dns_name_is_valid(n);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to validate specified domain %s: %m", n);
|
||||
if (r == 0) {
|
||||
log_error("Domain not valid: %s", n);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (r == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Domain not valid: %s",
|
||||
n);
|
||||
|
||||
r = sd_bus_message_append(req, "(sb)", n, **p == '~');
|
||||
if (r < 0)
|
||||
@@ -2348,10 +2346,10 @@ static int verb_nta(int argc, char **argv, void *userdata) {
|
||||
r = dns_name_is_valid(*p);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to validate specified domain %s: %m", *p);
|
||||
if (r == 0) {
|
||||
log_error("Domain not valid: %s", *p);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (r == 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Domain not valid: %s",
|
||||
*p);
|
||||
}
|
||||
|
||||
r = call_nta(bus, clear ? NULL : argv + 2, bus_resolve_mgr, &error);
|
||||
|
||||
@@ -1435,7 +1435,7 @@ int dns_packet_read_name(
|
||||
|
||||
n += r;
|
||||
continue;
|
||||
} else if (allow_compression && (c & 0xc0) == 0xc0) {
|
||||
} else if (allow_compression && FLAGS_SET(c, 0xc0)) {
|
||||
uint16_t ptr;
|
||||
|
||||
/* Pointer */
|
||||
@@ -2250,12 +2250,11 @@ static int dns_packet_extract_answer(DnsPacket *p, DnsAnswer **ret_answer) {
|
||||
if (DNS_PACKET_QR(p)) {
|
||||
/* Additional checks for responses */
|
||||
|
||||
if (!DNS_RESOURCE_RECORD_OPT_VERSION_SUPPORTED(rr)) {
|
||||
if (!DNS_RESOURCE_RECORD_OPT_VERSION_SUPPORTED(rr))
|
||||
/* If this is a reply and we don't know the EDNS version
|
||||
* then something is weird... */
|
||||
log_debug("EDNS version newer that our request, bad server.");
|
||||
return -EBADMSG;
|
||||
}
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EBADMSG),
|
||||
"EDNS version newer that our request, bad server.");
|
||||
|
||||
if (has_rfc6975) {
|
||||
/* If the OPT RR contains RFC6975 algorithm data, then this
|
||||
|
||||
@@ -908,13 +908,11 @@ static int dns_query_cname_redirect(DnsQuery *q, const DnsResourceRecord *cname)
|
||||
if (r == 0 && k == 0) /* No actual cname happened? */
|
||||
return -ELOOP;
|
||||
|
||||
if (q->answer_protocol == DNS_PROTOCOL_DNS) {
|
||||
if (q->answer_protocol == DNS_PROTOCOL_DNS)
|
||||
/* Don't permit CNAME redirects from unicast DNS to LLMNR or MulticastDNS, so that global resources
|
||||
* cannot invade the local namespace. The opposite way we permit: local names may redirect to global
|
||||
* ones. */
|
||||
|
||||
q->flags &= ~(SD_RESOLVED_LLMNR|SD_RESOLVED_MDNS); /* mask away the local protocols */
|
||||
}
|
||||
|
||||
/* Turn off searching for the new name */
|
||||
q->flags |= SD_RESOLVED_NO_SEARCH;
|
||||
|
||||
@@ -97,15 +97,15 @@ static int dnssd_service_load(Manager *manager, const char *filename) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!service->name_template) {
|
||||
log_error("%s doesn't define service instance name", service->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!service->name_template)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"%s doesn't define service instance name",
|
||||
service->name);
|
||||
|
||||
if (!service->type) {
|
||||
log_error("%s doesn't define service type", service->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!service->type)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"%s doesn't define service type",
|
||||
service->name);
|
||||
|
||||
if (LIST_IS_EMPTY(service->txt_data_items)) {
|
||||
txt_data = new0(DnssdTxtData, 1);
|
||||
|
||||
@@ -786,10 +786,8 @@ int manager_recv(Manager *m, int fd, DnsProtocol protocol, DnsPacket **ret) {
|
||||
l = recvmsg_safe(fd, &mh, 0);
|
||||
if (IN_SET(l, -EAGAIN, -EINTR))
|
||||
return 0;
|
||||
if (l < 0)
|
||||
if (l <= 0)
|
||||
return l;
|
||||
if (l == 0)
|
||||
return 0;
|
||||
|
||||
assert(!(mh.msg_flags & MSG_TRUNC));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user