From 09da69b1c782557b8f8565aa4e6b0e0c86144590 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Wed, 9 Feb 2022 08:34:35 +0100 Subject: [PATCH] posix.cfg: Added support for 'llseek()', which is obsolescent since glibc version 2.28 --- cfg/posix.cfg | 25 +++++++++++++++++++++++++ test/cfg/posix.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/cfg/posix.cfg b/cfg/posix.cfg index 3adced971..a37842d0a 100644 --- a/cfg/posix.cfg +++ b/cfg/posix.cfg @@ -3418,6 +3418,29 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s 0:2 + + + + + false + + + + + 0: + + + + + + + + + 0:2 + + + + @@ -5429,6 +5452,8 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s + + diff --git a/test/cfg/posix.c b/test/cfg/posix.c index eb7919bbe..a19d0186e 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -29,6 +29,36 @@ #include #include +// Note: Since glibc 2.28, this function symbol is no longer available to newly linked applications. +void invalidFunctionArg_llseek(int fd, loff_t offset, int origin) +{ + // cppcheck-suppress llseekCalled + // cppcheck-suppress invalidFunctionArg + (void)llseek(-1, offset, SEEK_SET); + // cppcheck-suppress llseekCalled + // cppcheck-suppress invalidFunctionArg + (void)llseek(fd, offset, -1); + // cppcheck-suppress llseekCalled + // cppcheck-suppress invalidFunctionArg + (void)llseek(fd, offset, 3); + // cppcheck-suppress llseekCalled + // cppcheck-suppress invalidFunctionArg + (void)llseek(fd, offset, 42+SEEK_SET); + // cppcheck-suppress llseekCalled + // cppcheck-suppress invalidFunctionArg + (void)llseek(fd, offset, SEEK_SET+42); + // No invalidFunctionArg warning is expected for + // cppcheck-suppress llseekCalled + (void)llseek(0, offset, origin); + // cppcheck-suppress llseekCalled + (void)llseek(fd, offset, origin); + // cppcheck-suppress llseekCalled + (void)llseek(fd, offset, SEEK_SET); + // cppcheck-suppress llseekCalled + (void)llseek(fd, offset, SEEK_CUR); + // cppcheck-suppress llseekCalled + (void)llseek(fd, offset, SEEK_END); +} void invalidFunctionArg_lseek64(int fd, off_t offset, int origin) {