Adding upstream version 4.2+20230901.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
14fbe53fb1
commit
f48db6685a
15 changed files with 418 additions and 196 deletions
19
lib.c
19
lib.c
|
@ -585,3 +585,22 @@ int parse_num(int *dest, const char *num)
|
|||
*dest = temp;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* s_gethostname() - secure get hostname. Assure null-terminated string.
|
||||
*
|
||||
* @buf: buffer for hostname.
|
||||
* @buf_len: buffer length.
|
||||
*
|
||||
* Return: gethostname() result.
|
||||
*/
|
||||
int s_gethostname(char *buf, int buf_len)
|
||||
{
|
||||
assert(buf);
|
||||
|
||||
int ret = gethostname(buf, buf_len);
|
||||
|
||||
buf[buf_len - 1] = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue