posix.cfg: Added support for getgrnam_r() and getgrgid_r().
This commit is contained in:
parent
28da263d8b
commit
ba57f33f81
|
@ -4740,6 +4740,60 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
|||
</arg>
|
||||
<warn severity="portability">Non reentrant function 'getgrgid' called. For threadsafe applications it is recommended to use the reentrant replacement function 'getgrgid_r'.</warn>
|
||||
</function>
|
||||
<!-- https://man7.org/linux/man-pages/man3/getgrnam.3.html -->
|
||||
<!-- int getgrnam_r(const char *restrict name, struct group *restrict grp, char *restrict buf, size_t buflen, struct group **restrict result); -->
|
||||
<function name="getgrnam_r">
|
||||
<returnValue type="int"/>
|
||||
<use-retval/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
</arg>
|
||||
<arg nr="2" direction="out">
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="3" direction="out">
|
||||
<not-null/>
|
||||
<minsize type="argvalue" arg="4"/>
|
||||
</arg>
|
||||
<arg nr="4" direction="in">
|
||||
<not-uninit/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
<arg nr="5" direction="out">
|
||||
<not-null/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- https://man7.org/linux/man-pages/man3/getgrnam.3.html -->
|
||||
<!-- int getgrgid_r(gid_t gid, struct group *restrict grp, char *restrict buf, size_t buflen, struct group **restrict result); -->
|
||||
<function name="getgrgid_r">
|
||||
<returnValue type="int"/>
|
||||
<use-retval/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
</arg>
|
||||
<arg nr="2" direction="out">
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="3" direction="out">
|
||||
<not-null/>
|
||||
<minsize type="argvalue" arg="4"/>
|
||||
</arg>
|
||||
<arg nr="4" direction="in">
|
||||
<not-uninit/>
|
||||
<valid>0:</valid>
|
||||
</arg>
|
||||
<arg nr="5" direction="out">
|
||||
<not-null/>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- char *getlogin(void); -->
|
||||
<function name="getlogin">
|
||||
<returnValue type="char *"/>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <sys/sem.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <grp.h>
|
||||
#include <dlfcn.h>
|
||||
#include <fcntl.h>
|
||||
// unavailable on some linux systems #include <ndbm.h>
|
||||
|
@ -33,6 +34,30 @@
|
|||
#include <string.h>
|
||||
#include <strings.h>
|
||||
|
||||
int nullPointer_getgrgid_r(gid_t gid, struct group *restrict grp, char *restrict buf, size_t buflen, struct group **restrict result)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) getgrgid_r(gid, NULL, buf, buflen, result);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) getgrgid_r(gid, grp, NULL, buflen, result);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) getgrgid_r(gid, grp, buf, buflen, NULL);
|
||||
return getgrgid_r(gid, grp, buf, buflen, result);
|
||||
}
|
||||
|
||||
int nullPointer_getgrnam_r(const char *restrict name, struct group *restrict grp, char *restrict buf, size_t buflen, struct group **restrict result)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) getgrnam_r(NULL, grp, buf, buflen, result);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) getgrnam_r(name, NULL, buf, buflen, result);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) getgrnam_r(name, grp, NULL, buflen, result);
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) getgrnam_r(name, grp, buf, buflen, NULL);
|
||||
return getgrnam_r(name, grp, buf, buflen, result);
|
||||
}
|
||||
|
||||
void knownConditionTrueFalse_ffs(int i)
|
||||
{
|
||||
// ffs() returns the position of the first bit set, or 0 if no bits are set in i.
|
||||
|
|
Loading…
Reference in New Issue