posix.cfg: Ensure null pointer input is correctly handled for gethostname().

This commit is contained in:
orbitcowboy 2022-04-20 17:40:03 +02:00
parent d0ff2a022a
commit 1055b118a4
1 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,14 @@ int nullPointer_wcsnlen(const wchar_t *s, size_t n)
return wcsnlen(s, n); return wcsnlen(s, n);
} }
int nullPointer_gethostname(char *s, size_t n)
{
// cppcheck-suppress nullPointer
(void)gethostname(NULL, n);
// No warning is expected
return gethostname(s, n);
}
int nullPointer_wcswidth(const wchar_t *s, size_t n) int nullPointer_wcswidth(const wchar_t *s, size_t n)
{ {
// cppcheck-suppress nullPointer // cppcheck-suppress nullPointer