posix.cfg: Added support for getlogin_r().

This commit is contained in:
orbitcowboy 2022-04-26 10:04:15 +02:00
parent 9e9997be32
commit bfbc7e1549
2 changed files with 24 additions and 0 deletions

View File

@ -4646,6 +4646,23 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<leak-ignore/>
<warn severity="portability">Non reentrant function 'getlogin' called. For threadsafe applications it is recommended to use the reentrant replacement function 'getlogin_r'.</warn>
</function>
<!-- https://man7.org/linux/man-pages/man3/getlogin.3.html -->
<!-- int getlogin_r(char *buf, size_t bufsize); -->
<function name="getlogin_r">
<returnValue type="int"/>
<use-retval/>
<noreturn>false</noreturn>
<leak-ignore/>
<arg nr="1" direction="out">
<not-null/>
<minsize type="argvalue" arg="2"/>
</arg>
<arg nr="2" direction="in">
<not-bool/>
<not-uninit/>
<valid>0:</valid>
</arg>
</function>
<!-- char *ctermid(char *s); -->
<function name="ctermid">
<returnValue type="char *"/>

View File

@ -31,6 +31,13 @@
#include <wchar.h>
#include <string.h>
int nullPointer_getlogin_r(char *buf, size_t bufsize)
{
// cppcheck-suppress nullPointer
(void)getlogin_r(NULL,bufsize);
return getlogin_r(buf,bufsize);
}
ssize_t uninitvar_pread(int fd, void *buf, size_t nbyte, off_t offset)
{
int Fd;