tree-wide: assorted coccinelle fixes
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);
|
||||
|
||||
@@ -1426,7 +1426,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 */
|
||||
@@ -2241,12 +2241,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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -780,10 +780,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