posix.cfg: Improved configuration for close(). Issue a warning in case close is called with a file pointer having a negative value.
This commit is contained in:
parent
bca2dfb3f4
commit
45a3f679b4
|
@ -1114,9 +1114,10 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
|||
<function name="close">
|
||||
<noreturn>false</noreturn>
|
||||
<returnValue type="int"/>
|
||||
<arg nr="1">
|
||||
<arg nr="1" direction="in">
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- size_t confstr(int, char *, size_t); -->
|
||||
|
|
|
@ -215,6 +215,14 @@ void invalidFunctionArg()
|
|||
usleep(1000000);
|
||||
}
|
||||
|
||||
void invalidFunctionArg_close(int fd)
|
||||
{
|
||||
if (fd < 0) {
|
||||
// cppcheck-suppress invalidFunctionArg
|
||||
(void)close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
void uninitvar(int fd)
|
||||
{
|
||||
int x1, x2, x3, x4;
|
||||
|
|
Loading…
Reference in New Issue