posix.cfg: Improved configuration of getpwnam_r().

This commit is contained in:
orbitcowboy 2022-05-02 16:41:33 +02:00
parent 67f4fe575f
commit 8cc16f1adb
2 changed files with 19 additions and 1 deletions

View File

@ -3366,9 +3366,13 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<noreturn>false</noreturn>
<arg nr="1" direction="in">
<not-uninit/>
<not-null/>
</arg>
<arg nr="2" direction="out">
<not-null/>
</arg>
<arg nr="2" direction="out"/>
<arg nr="3" direction="out">
<not-null/>
<minsize type="argvalue" arg="4"/>
</arg>
<arg nr="4" direction="in">
@ -3378,6 +3382,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
</arg>
<arg nr="5" direction="out">
<not-bool/>
<not-null/>
</arg>
</function>
<!-- struct passwd *getpwuid(uid_t uid); -->

View File

@ -35,6 +35,19 @@
#include <string.h>
#include <strings.h>
int nullPointer_getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
{
// cppcheck-suppress nullPointer
(void) getpwnam_r(NULL, pwd, buffer, bufsize, result);
// cppcheck-suppress nullPointer
(void) getpwnam_r(name, NULL, buffer, bufsize, result);
// cppcheck-suppress nullPointer
(void) getpwnam_r(name, pwd, NULL, bufsize, result);
// cppcheck-suppress nullPointer
(void) getpwnam_r(name, pwd, buffer, bufsize, NULL);
return getpwnam_r(name, pwd, buffer, bufsize, result);
}
int nullPointer_fgetpwent_r(FILE *restrict stream, struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp)
{
// cppcheck-suppress nullPointer