summaryrefslogtreecommitdiff
path: root/openbsd-compat/strlcpy.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-09-23 10:38:11 +1000
committerDamien Miller <djm@mindrot.org>2011-09-23 10:38:11 +1000
commitb9cd0491f712ec489edf94977e9867be1b8e157c (patch)
tree72ea5472794ac50d414a8e3e26a7c1b24dd2677d /openbsd-compat/strlcpy.c
parentadd1e20802bb781593ac7554a4c45b1576eca3ca (diff)
- millert@cvs.openbsd.org 2006/05/05 15:27:38
[openbsd-compat/strlcpy.c] Convert do {} while loop -> while {} for clarity. No binary change on most architectures. From Oliver Smith. OK deraadt@ and henning@
Diffstat (limited to 'openbsd-compat/strlcpy.c')
-rw-r--r--openbsd-compat/strlcpy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/openbsd-compat/strlcpy.c b/openbsd-compat/strlcpy.c
index 679a5b291..b4b1b6015 100644
--- a/openbsd-compat/strlcpy.c
+++ b/openbsd-compat/strlcpy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strlcpy.c,v 1.10 2005/08/08 08:05:37 espie Exp $ */ 1/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -37,11 +37,11 @@ strlcpy(char *dst, const char *src, size_t siz)
37 size_t n = siz; 37 size_t n = siz;
38 38
39 /* Copy as many bytes as will fit */ 39 /* Copy as many bytes as will fit */
40 if (n != 0 && --n != 0) { 40 if (n != 0) {
41 do { 41 while (--n != 0) {
42 if ((*d++ = *s++) == 0) 42 if ((*d++ = *s++) == '\0')
43 break; 43 break;
44 } while (--n != 0); 44 }
45 } 45 }
46 46
47 /* Not enough room in dst, add NUL and traverse rest of src */ 47 /* Not enough room in dst, add NUL and traverse rest of src */