about summary refs log tree commit diff
path: root/sysdeps/generic/stpncpy.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/generic/stpncpy.c')
-rw-r--r--sysdeps/generic/stpncpy.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sysdeps/generic/stpncpy.c b/sysdeps/generic/stpncpy.c
index 40c9173477..d4a524086c 100644
--- a/sysdeps/generic/stpncpy.c
+++ b/sysdeps/generic/stpncpy.c
@@ -79,9 +79,8 @@ DEFUN(__stpncpy, (dest, src, n), char *dest AND CONST char *src AND size_t n)
   while (c != '\0');
 
  zero_fill:
-  do
-    *++dest = '\0';
-  while (--n > 0);
+  while (n-- > 0)
+    dest[n] = '\0';
 
   return dest;
 }