posix.cfg: Added support for lseek64().

This commit is contained in:
orbitcowboy 2022-02-07 14:15:48 +01:00
parent bd1d8ea7b8
commit c983151b9c
2 changed files with 42 additions and 0 deletions

View File

@ -3397,6 +3397,27 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<valid>0:2</valid> <valid>0:2</valid>
</arg> </arg>
</function> </function>
<!-- https://man7.org/linux/man-pages/man3/lseek64.3.html -->
<!-- off64_t lseek64(int fildes, off64_t offset, int whence); defined in POSIX.1 (1996). -->
<function name="lseek64">
<returnValue type="off64_t"/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:</valid>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
<not-bool/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
<valid>0:2</valid>
</arg>
</function>
<!-- int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); --> <!-- int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); -->
<function name="nanosleep"> <function name="nanosleep">
<returnValue type="int"/> <returnValue type="int"/>

View File

@ -29,6 +29,27 @@
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
void invalidFunctionArg_lseek64(int fd, off_t offset, int origin)
{
// cppcheck-suppress invalidFunctionArg
(void)lseek64(-1, offset, SEEK_SET);
// cppcheck-suppress invalidFunctionArg
(void)lseek64(fd, offset, -1);
// cppcheck-suppress invalidFunctionArg
(void)lseek64(fd, offset, 3);
// cppcheck-suppress invalidFunctionArg
(void)lseek64(fd, offset, 42+SEEK_SET);
// cppcheck-suppress invalidFunctionArg
(void)lseek64(fd, offset, SEEK_SET+42);
// No warning is expected for
(void)lseek64(0, offset, origin);
(void)lseek64(fd, offset, origin);
(void)lseek64(fd, offset, SEEK_SET);
(void)lseek64(fd, offset, SEEK_CUR);
(void)lseek64(fd, offset, SEEK_END);
}
void invalidFunctionArg_lseek(int fd, off_t offset, int origin) void invalidFunctionArg_lseek(int fd, off_t offset, int origin)
{ {
// cppcheck-suppress invalidFunctionArg // cppcheck-suppress invalidFunctionArg