diff --git a/cfg/posix.cfg b/cfg/posix.cfg index f28469747..c7f37f50b 100644 --- a/cfg/posix.cfg +++ b/cfg/posix.cfg @@ -3394,6 +3394,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s + 0:2 diff --git a/test/cfg/posix.c b/test/cfg/posix.c index cff20eaf5..5cc3a0360 100644 --- a/test/cfg/posix.c +++ b/test/cfg/posix.c @@ -29,6 +29,26 @@ #include #include +void invalidFunctionArg_lseek(int fd, off_t offset, int origin) +{ + // cppcheck-suppress invalidFunctionArg + (void)lseek(-1, offset, SEEK_SET); + // cppcheck-suppress invalidFunctionArg + (void)lseek(fd, offset, -1); + // cppcheck-suppress invalidFunctionArg + (void)lseek(fd, offset, 3); + // cppcheck-suppress invalidFunctionArg + (void)lseek(fd, offset, 42+SEEK_SET); + // cppcheck-suppress invalidFunctionArg + (void)lseek(fd, offset, SEEK_SET+42); + // No warning is expected for + (void)lseek(0, offset, origin); + (void)lseek(fd, offset, origin); + (void)lseek(fd, offset, SEEK_SET); + (void)lseek(fd, offset, SEEK_CUR); + (void)lseek(fd, offset, SEEK_END); +} + void invalidFunctionArg_fseeko(FILE* stream, off_t offset, int origin) { // cppcheck-suppress invalidFunctionArg