posix.cfg: Added support for fgetpwent_r().

This commit is contained in:
orbitcowboy 2022-05-02 12:56:47 +02:00
parent 86cc410dc2
commit 6c54e7363d
2 changed files with 40 additions and 0 deletions

View File

@ -3272,6 +3272,33 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<warn severity="portability">Non reentrant function 'getpwent' called. For threadsafe applications it is recommended to use the reentrant replacement function 'getpwent_r'.</warn>
</function>
<!-- https://man7.org/linux/man-pages/man3/getpwent_r.3.html-->
<!-- int fgetpwent_r(FILE *restrict stream, struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp); -->
<function name="fgetpwent_r">
<use-retval/>
<returnValue type="int"/>
<noreturn>false</noreturn>
<arg nr="1" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-null/>
<not-uninit/>
</arg>
<arg nr="3" direction="out">
<not-null/>
<minsize type="argvalue" arg="3"/>
</arg>
<arg nr="4" direction="in">
<not-uninit/>
<valid>0:</valid>
</arg>
<arg nr="5" direction="out">
<not-null/>
<not-bool/>
</arg>
</function>
<!-- https://man7.org/linux/man-pages/man3/getpwent_r.3.html-->
<!-- int getpwent_r(struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp); -->
<function name="getpwent_r">
<use-retval/>

View File

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