]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
- millert@cvs.openbsd.org 2006/05/05 15:27:38
authorDamien Miller <djm@mindrot.org>
Fri, 23 Sep 2011 00:38:11 +0000 (10:38 +1000)
committerDamien Miller <djm@mindrot.org>
Fri, 23 Sep 2011 00:38:11 +0000 (10:38 +1000)
     [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

index 679a5b291f58b5f6efe2e08565aa508566cd92dd..b4b1b6015a28e5075dcfb1f20b5b58562e4eff1b 100644 (file)
@@ -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>
@@ -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 */