#6181 Drop redundantGetAndSetUserId. Ensure (style-) warnings are issued if setuid()/getuid() and some related functions are ignored. Move strdupa()/strndupa() from posix.cfg to gnu.cfg
This commit is contained in:
parent
42b40b0c85
commit
115cefc8fb
|
@ -0,0 +1,22 @@
|
|||
|
||||
// Test library configuration for gnu.cfg
|
||||
//
|
||||
// Usage:
|
||||
// $ cppcheck --check-library --library=gnu --enable=information --enable=style --error-exitcode=1 --inline-suppr test/cfg/gnu.c
|
||||
// =>
|
||||
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
||||
//
|
||||
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void leakReturnValNotUsed() {
|
||||
// cppcheck-suppress unreadVariable
|
||||
char* ptr = strdupa("test");
|
||||
// cppcheck-suppress ignoredReturnValue
|
||||
strdupa("test");
|
||||
// cppcheck-suppress unreadVariable
|
||||
char* ptr2 = strndupa("test", 1);
|
||||
// cppcheck-suppress ignoredReturnValue
|
||||
strndupa("test", 1);
|
||||
}
|
Loading…
Reference in New Issue