lib/strutils: fix strnlen() fallback

Addresses: https://github.com/karelzak/util-linux/issues/643
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2018-05-28 12:30:34 +02:00
parent 5ac0b26994
commit 64af1a2987
1 changed files with 2 additions and 2 deletions

View File

@ -243,11 +243,11 @@ void *mempcpy(void *restrict dest, const void *restrict src, size_t n)
#ifndef HAVE_STRNLEN
size_t strnlen(const char *s, size_t maxlen)
{
int i;
size_t i;
for (i = 0; i < maxlen; i++) {
if (s[i] == '\0')
return i + 1;
return i;
}
return maxlen;
}