about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLiubov Dmitrieva <ldmitrie@sourceware.org>2013-08-29 19:25:35 +0400
committerLiubov Dmitrieva <ldmitrie@sourceware.org>2013-10-23 19:07:36 +0400
commit0e036f35e545b187f4ee71bb48cffb8e9cc855b9 (patch)
tree49fe2881a53f5e8f3dcf8a810aecd888e8828483
parent7f5505c12769e739442d52bf29903f93ff2322c2 (diff)
downloadglibc-0e036f35e545b187f4ee71bb48cffb8e9cc855b9.tar.gz
glibc-0e036f35e545b187f4ee71bb48cffb8e9cc855b9.tar.xz
glibc-0e036f35e545b187f4ee71bb48cffb8e9cc855b9.zip
Inappropriate code style for Intel MPX in debug/wcscpy_chk.c. Fix the code if MPX is enabled.
-rw-r--r--debug/wcscpy_chk.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/debug/wcscpy_chk.c b/debug/wcscpy_chk.c
index 61092c3d96..3e6d18574c 100644
--- a/debug/wcscpy_chk.c
+++ b/debug/wcscpy_chk.c
@@ -23,6 +23,7 @@
 /* Copy SRC to DEST.  */
 wchar_t *
 __wcscpy_chk (wchar_t *dest, const wchar_t *src, size_t n)
+#ifndef __CHKP__
 {
   wint_t c;
   wchar_t *wcp;
@@ -58,3 +59,22 @@ __wcscpy_chk (wchar_t *dest, const wchar_t *src, size_t n)
 
   return dest;
 }
+#else
+{
+  const wchar_t *result = dest;
+  dest--;
+  wint_t c;
+
+  do
+	{
+	  if (__builtin_expect (n-- == 0, 0))
+	     __chk_fail ();
+	  c = src[0];
+	  *++dest = c;
+	  ++src;
+	}
+  while (c != L'\0');
+
+  return result;
+}
+#endif