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">
|
<function name="close">
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<returnValue type="int"/>
|
<returnValue type="int"/>
|
||||||
<arg nr="1">
|
<arg nr="1" direction="in">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
<not-bool/>
|
<not-bool/>
|
||||||
|
<valid>0:</valid>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- size_t confstr(int, char *, size_t); -->
|
<!-- size_t confstr(int, char *, size_t); -->
|
||||||
|
|
|
@ -215,6 +215,14 @@ void invalidFunctionArg()
|
||||||
usleep(1000000);
|
usleep(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void invalidFunctionArg_close(int fd)
|
||||||
|
{
|
||||||
|
if (fd < 0) {
|
||||||
|
// cppcheck-suppress invalidFunctionArg
|
||||||
|
(void)close(fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void uninitvar(int fd)
|
void uninitvar(int fd)
|
||||||
{
|
{
|
||||||
int x1, x2, x3, x4;
|
int x1, x2, x3, x4;
|
||||||
|
|
Loading…
Reference in New Issue