From b9cd0491f712ec489edf94977e9867be1b8e157c Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 23 Sep 2011 10:38:11 +1000 Subject: - 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@ --- openbsd-compat/strlcpy.c | 10 +++++----- 1 file 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 @@ -/* $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 @@ -37,11 +37,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 */ -- cgit v1.2.3