From 0cf1a4b3a7e0b870912ec0f986aa8107309a761e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 7 Oct 2022 15:59:34 +0200 Subject: [PATCH] Get rid of strerror_safe() --- .github/codeql-queries/PotentiallyDangerousFunction.ql | 2 +- src/basic/errno-util.h | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/codeql-queries/PotentiallyDangerousFunction.ql b/.github/codeql-queries/PotentiallyDangerousFunction.ql index 63fd14e75f..d5a5635c35 100644 --- a/.github/codeql-queries/PotentiallyDangerousFunction.ql +++ b/.github/codeql-queries/PotentiallyDangerousFunction.ql @@ -42,7 +42,7 @@ predicate potentiallyDangerousFunction(Function f, string message) { message = "Call to ntohs() is confusing. Use be16toh() instead." ) or ( f.getQualifiedName() = "strerror" and - message = "Call to strerror() is not thread-safe. Use strerror_r() or printf()'s %m format string instead." + message = "Call to strerror() is not thread-safe. Use printf()'s %m format string or STRERROR() instead." ) or ( f.getQualifiedName() = "accept" and message = "Call to accept() is not O_CLOEXEC-safe. Use accept4() instead." diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h index 66b3e53ade..80b1edac6f 100644 --- a/src/basic/errno-util.h +++ b/src/basic/errno-util.h @@ -73,11 +73,6 @@ static inline int RET_NERRNO(int ret) { return ret; } -static inline const char *strerror_safe(int error) { - /* 'safe' here does NOT mean thread safety. */ - return strerror(abs(error)); -} - static inline int errno_or_else(int fallback) { /* To be used when invoking library calls where errno handling is not defined clearly: we return * errno if it is set, and the specified error otherwise. The idea is that the caller initializes