summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strlcpy.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2006-05-05 15:27:38 +0000
committermillert <millert@openbsd.org>2006-05-05 15:27:38 +0000
commitb9c631e7e9c23759a6745d2a0a470cc5cb8f7cc0 (patch)
treef8999b4ab693ba92311929b2c56f55f9ec0a0eeb /lib/libc/string/strlcpy.c
parent- no need to escape these (diff)
downloadwireguard-openbsd-b9c631e7e9c23759a6745d2a0a470cc5cb8f7cc0.tar.xz
wireguard-openbsd-b9c631e7e9c23759a6745d2a0a470cc5cb8f7cc0.zip
Convert do {} while loop -> while {} for clarity. No binary change
on most architectures. From Oliver Smith. OK deraadt@ and henning@
Diffstat (limited to 'lib/libc/string/strlcpy.c')
-rw-r--r--lib/libc/string/strlcpy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/string/strlcpy.c b/lib/libc/string/strlcpy.c
index 110155f76fa..d32b6590f1e 100644
--- a/lib/libc/string/strlcpy.c
+++ b/lib/libc/string/strlcpy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strlcpy.c,v 1.10 2005/08/08 08:05:37 espie Exp $ */
+/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -32,11 +32,11 @@ strlcpy(char *dst, const char *src, size_t siz)
size_t n = siz;
/* Copy as many bytes as will fit */
- if (n != 0 && --n != 0) {
- do {
- if ((*d++ = *s++) == 0)
+ if (n != 0) {
+ while (--n != 0) {
+ if ((*d++ = *s++) == '\0')
break;
- } while (--n != 0);
+ }
}
/* Not enough room in dst, add NUL and traverse rest of src */