Skip to content

Commit 6c54e73

Browse files
committed
posix.cfg: Added support for fgetpwent_r().
1 parent 86cc410 commit 6c54e73

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

cfg/posix.cfg

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3272,6 +3272,33 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
32723272
<warn severity="portability">Non reentrant function 'getpwent' called. For threadsafe applications it is recommended to use the reentrant replacement function 'getpwent_r'.</warn>
32733273
</function>
32743274
<!-- https://man7.org/linux/man-pages/man3/getpwent_r.3.html-->
3275+
<!-- int fgetpwent_r(FILE *restrict stream, struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp); -->
3276+
<function name="fgetpwent_r">
3277+
<use-retval/>
3278+
<returnValue type="int"/>
3279+
<noreturn>false</noreturn>
3280+
<arg nr="1" direction="in">
3281+
<not-null/>
3282+
<not-uninit/>
3283+
</arg>
3284+
<arg nr="2" direction="in">
3285+
<not-null/>
3286+
<not-uninit/>
3287+
</arg>
3288+
<arg nr="3" direction="out">
3289+
<not-null/>
3290+
<minsize type="argvalue" arg="3"/>
3291+
</arg>
3292+
<arg nr="4" direction="in">
3293+
<not-uninit/>
3294+
<valid>0:</valid>
3295+
</arg>
3296+
<arg nr="5" direction="out">
3297+
<not-null/>
3298+
<not-bool/>
3299+
</arg>
3300+
</function>
3301+
<!-- https://man7.org/linux/man-pages/man3/getpwent_r.3.html-->
32753302
<!-- int getpwent_r(struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp); -->
32763303
<function name="getpwent_r">
32773304
<use-retval/>

test/cfg/posix.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@
3535
#include <string.h>
3636
#include <strings.h>
3737

38+
int nullPointer_fgetpwent_r(FILE *restrict stream, struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp)
39+
{
40+
// cppcheck-suppress nullPointer
41+
(void) fgetpwent_r(NULL, pwbuf, buf, buflen, pwbufp);
42+
// cppcheck-suppress nullPointer
43+
(void) fgetpwent_r(stream, NULL, buf, buflen, pwbufp);
44+
// cppcheck-suppress nullPointer
45+
(void) fgetpwent_r(stream, pwbuf, NULL, buflen, pwbufp);
46+
// cppcheck-suppress nullPointer
47+
(void) fgetpwent_r(stream, pwbuf, buf, buflen, NULL);
48+
return fgetpwent_r(stream, pwbuf, buf, buflen, pwbufp);
49+
}
50+
3851
int nullPointer_getpwent_r(struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp)
3952
{
4053
// cppcheck-suppress nullPointer

0 commit comments

Comments
 (0)