Skip to content

Commit

Permalink
linuxkpi: Add strscpy_pad() to <linux/string.h>
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dumbbell committed Feb 15, 2023
1 parent 4dac88c commit b1a9e57
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sys/compat/linuxkpi/common/include/linux/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit b1a9e57

Please sign in to comment.