about summary refs log tree commit diff
path: root/debug/strncpy_chk.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug/strncpy_chk.c')
-rw-r--r--debug/strncpy_chk.c57
1 files changed, 1 insertions, 56 deletions
diff --git a/debug/strncpy_chk.c b/debug/strncpy_chk.c
index d067bd9ac3..2e078b1e4f 100644
--- a/debug/strncpy_chk.c
+++ b/debug/strncpy_chk.c
@@ -26,63 +26,8 @@ __strncpy_chk (s1, s2, n, s1len)
      size_t n;
      size_t s1len;
 {
-  char c;
-  char *s = s1;
-
   if (__builtin_expect (s1len < n, 0))
     __chk_fail ();
 
-  --s1;
-
-  if (n >= 4)
-    {
-      size_t n4 = n >> 2;
-
-      for (;;)
-	{
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  c = *s2++;
-	  *++s1 = c;
-	  if (c == '\0')
-	    break;
-	  if (--n4 == 0)
-	    goto last_chars;
-	}
-      n = n - (s1 - s) - 1;
-      if (n == 0)
-	return s;
-      goto zero_fill;
-    }
-
- last_chars:
-  n &= 3;
-  if (n == 0)
-    return s;
-
-  do
-    {
-      c = *s2++;
-      *++s1 = c;
-      if (--n == 0)
-	return s;
-    }
-  while (c != '\0');
-
- zero_fill:
-  do
-    *++s1 = '\0';
-  while (--n > 0);
-
-  return s;
+  return strncpy (s1, s2, n);
 }