Merge pull request #19243 from bluca/lgtm

Fix various issues reported by LGTM
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-04-09 13:12:41 +02:00
committed by GitHub
5 changed files with 76 additions and 130 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ static inline int negative_errno(void) {
static inline const char *strerror_safe(int error) {
/* 'safe' here does NOT mean thread safety. */
return strerror(abs(error));
return strerror(abs(error)); /* lgtm [cpp/potentially-dangerous-function] */
}
static inline int errno_or_else(int fallback) {
+2 -2
View File
@@ -51,7 +51,7 @@ bool in4_addr_is_link_local(const struct in_addr *a) {
bool in6_addr_is_link_local(const struct in6_addr *a) {
assert(a);
return IN6_IS_ADDR_LINKLOCAL(a);
return IN6_IS_ADDR_LINKLOCAL(a); /* lgtm [cpp/potentially-dangerous-function] */
}
int in_addr_is_link_local(int family, const union in_addr_union *u) {
@@ -116,7 +116,7 @@ int in_addr_is_localhost(int family, const union in_addr_union *u) {
return in4_addr_is_localhost(&u->in);
if (family == AF_INET6)
return IN6_IS_ADDR_LOOPBACK(&u->in6);
return IN6_IS_ADDR_LOOPBACK(&u->in6); /* lgtm [cpp/potentially-dangerous-function] */
return -EAFNOSUPPORT;
}