From 6e77a538ca63f2ecbab74656839e77084a2db425 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sat, 14 Apr 2001 00:22:33 +1000 Subject: - Sync with OpenBSD glob.c, strlcat.c and vis.c changes --- openbsd-compat/strlcat.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'openbsd-compat/strlcat.c') diff --git a/openbsd-compat/strlcat.c b/openbsd-compat/strlcat.c index 10ad9e71a..7631d9694 100644 --- a/openbsd-compat/strlcat.c +++ b/openbsd-compat/strlcat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */ +/* $OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $ */ /* * Copyright (c) 1998 Todd C. Miller @@ -31,7 +31,7 @@ #ifndef HAVE_STRLCAT #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $"; +static char *rcsid = "$OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -40,8 +40,9 @@ static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp /* * Appends src to string dst of size siz (unlike strncat, siz is the * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. + * will be copied. Always NUL terminates (unless siz <= strlen(dst)). + * Returns strlen(initial dst) + strlen(src); if retval >= siz, + * truncation occurred. */ size_t strlcat(dst, src, siz) char *dst; @@ -54,7 +55,7 @@ size_t strlcat(dst, src, siz) size_t dlen; /* Find the end of dst and adjust bytes left but don't go past end */ - while (*d != '\0' && n-- != 0) + while (n-- != 0 && *d != '\0') d++; dlen = d - dst; n = siz - dlen; -- cgit v1.2.3