linuxkpi: Add strscpy_pad() to <linux/string.h>

It's the same as `strscpy()` except that it fills the rest of the
destination buffer with zeroes if the source buffer is shorter.

Reviewed by:	manu
Approved by:	manu
This commit is contained in:
Jean-Sébastien Pédron 2023-02-15 00:46:13 +01:00
parent 4dac88cd15
commit b1a9e570fe
No known key found for this signature in database
GPG Key ID: 39E99761A5FD94CC

View File

@ -207,6 +207,15 @@ strscpy(char* dst, const char* src, size_t len)
return (-E2BIG);
}
static inline ssize_t
strscpy_pad(char* dst, const char* src, size_t len)
{
bzero(dst, len);
return (strscpy(dst, src, len));
}
static inline void *
memset32(uint32_t *b, uint32_t c, size_t len)
{