summaryrefslogtreecommitdiffstats
path: root/openbsd-compat/strlcat.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-04-14 00:22:33 +1000
committerDamien Miller <djm@mindrot.org>2001-04-14 00:22:33 +1000
commit6e77a538ca63f2ecbab74656839e77084a2db425 (patch)
tree03dd15234a4ccc802fba338e7b1e54e3a9e71b94 /openbsd-compat/strlcat.c
parent92d4a020011565d766153cbf85210157c33c541c (diff)
- Sync with OpenBSD glob.c, strlcat.c and vis.c changes
Diffstat (limited to 'openbsd-compat/strlcat.c')
-rw-r--r--openbsd-compat/strlcat.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/openbsd-compat/strlcat.c b/openbsd-compat/strlcat.c
index 10ad9e71..7631d969 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 <Todd.Miller@courtesan.com>
@@ -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 <sys/types.h>
@@ -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;