]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Get rid of strerror_safe()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 7 Oct 2022 13:59:34 +0000 (15:59 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 11 Oct 2022 14:59:00 +0000 (16:59 +0200)
.github/codeql-queries/PotentiallyDangerousFunction.ql
src/basic/errno-util.h

index 63fd14e75f611cfa0a7ab2686b17f1e18d6a9c93..d5a5635c356788e5cc05e36daa7a47f8bdab5055 100644 (file)
@@ -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."
index 66b3e53ade2759cbeee13d3b02f9380db9093e47..80b1edac6fcbc45a1f8c6543b1c9bdbea75c181a 100644 (file)
@@ -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