Home-grown xstrlcpy()

This commit is contained in:
Arun Prakash Jana 2017-05-16 22:22:49 +05:30
parent 3243a3082a
commit b817699b7f
No known key found for this signature in database
GPG key ID: A75979F35C080412

5
nnn.c
View file

@ -205,8 +205,9 @@ max_openfds()
static void static void
xstrlcpy(char *dest, const char *src, size_t n) xstrlcpy(char *dest, const char *src, size_t n)
{ {
strncpy(dest, src, n - 1); while (--n && (*dest++ = *src++));
dest[n - 1] = '\0'; if (!n)
*dest = '\0';
} }
/* /*