posix.cfg: Improved configuration of getpwuid_r().
This commit is contained in:
parent
8cc16f1adb
commit
5a7c998a79
|
@ -3396,17 +3396,21 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
||||||
</arg>
|
</arg>
|
||||||
<warn severity="portability">Non reentrant function 'getpwuid' called. For threadsafe applications it is recommended to use the reentrant replacement function 'getpwuid_r'.</warn>
|
<warn severity="portability">Non reentrant function 'getpwuid' called. For threadsafe applications it is recommended to use the reentrant replacement function 'getpwuid_r'.</warn>
|
||||||
</function>
|
</function>
|
||||||
<!-- https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpwuid.html -->
|
<!-- https://man7.org/linux/man-pages/man3/getpwnam.3.html -->
|
||||||
<!-- int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result); -->
|
<!-- int getpwuid_r(uid_t uid, struct passwd *restrict pwd, char *restrict buf, size_t buflen, struct passwd **restrict result) -->
|
||||||
<function name="getpwuid_r">
|
<function name="getpwuid_r">
|
||||||
<returnValue type="int"/>
|
<returnValue type="int"/>
|
||||||
|
<use-retval/>
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<arg nr="1" direction="in">
|
<arg nr="1" direction="in">
|
||||||
<not-uninit/>
|
<not-uninit/>
|
||||||
<not-bool/>
|
<not-bool/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="2" direction="out"/>
|
<arg nr="2" direction="out">
|
||||||
|
<not-null/>
|
||||||
|
</arg>
|
||||||
<arg nr="3" direction="out">
|
<arg nr="3" direction="out">
|
||||||
|
<not-null/>
|
||||||
<minsize type="argvalue" arg="4"/>
|
<minsize type="argvalue" arg="4"/>
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="4" direction="in">
|
<arg nr="4" direction="in">
|
||||||
|
@ -3416,6 +3420,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
||||||
</arg>
|
</arg>
|
||||||
<arg nr="5" direction="out">
|
<arg nr="5" direction="out">
|
||||||
<not-bool/>
|
<not-bool/>
|
||||||
|
<not-null/>
|
||||||
</arg>
|
</arg>
|
||||||
</function>
|
</function>
|
||||||
<!-- void setpwent(void); -->
|
<!-- void setpwent(void); -->
|
||||||
|
|
|
@ -35,6 +35,17 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
|
int nullPointer_getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
|
||||||
|
{
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void) getpwuid_r(uid, NULL, buffer, bufsize, result);
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void) getpwuid_r(uid, pwd, NULL, bufsize, result);
|
||||||
|
// cppcheck-suppress nullPointer
|
||||||
|
(void) getpwuid_r(uid, pwd, buffer, bufsize, NULL);
|
||||||
|
return getpwuid_r(uid, pwd, buffer, bufsize, result);
|
||||||
|
}
|
||||||
|
|
||||||
int nullPointer_getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
|
int nullPointer_getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result)
|
||||||
{
|
{
|
||||||
// cppcheck-suppress nullPointer
|
// cppcheck-suppress nullPointer
|
||||||
|
|
Loading…
Reference in New Issue