mirror of
https://github.com/jarun/nnn.git
synced 2025-02-26 03:01:32 +00:00
Home-grown xstrlcpy()
This commit is contained in:
parent
3243a3082a
commit
b817699b7f
1 changed files with 3 additions and 2 deletions
5
nnn.c
5
nnn.c
|
@ -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';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue