summaryrefslogtreecommitdiff
path: root/string/bug-strncat1.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-10-30 04:08:58 +0000
committerUlrich Drepper <drepper@redhat.com>2000-10-30 04:08:58 +0000
commit9c3b1ceba810a51cb0069644e1bc72cb9a1cbc8c (patch)
tree44df27f8867ae748b1923888bdd9bde08c65034e /string/bug-strncat1.c
parentf58580396d75a6d7429a909444ad8b70dd7dfff8 (diff)
Update.
* string/bits/string2.h (strspn): Evaluate first argument if second is "". (strpbrk): Likewise. * sysdeps/i386/i486/bits/string.h: Likewise. * string/Makefile (tests): Add bug-strspn1 and bug-strpbrk1. * string/bug-strspn1.c: New file. * string/bug-strpbrk1.c: New file. Test cases by Joseph S. Myers <jsm28@cam.ac.uk>. * string/bits/string2.h (strncat): Terminate string correctly. * sysdeps/i386/i486/bits/string.h (strncat): Likewise. * string/Makefile (tests): Add bug-strncat1. * string/bug-strncat1.c: New file. Test case by Joseph S. Myers <jsm28@cam.ac.uk>. 2000-10-27 Ben Collins <bcollins@debian.org> * sysdeps/generic/lockf.c (lockf): Set l_type to F_RDLCK before calling for F_GETLK. 2000-10-29 Ulrich Drepper <drepper@redhat.com>
Diffstat (limited to 'string/bug-strncat1.c')
-rw-r--r--string/bug-strncat1.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/string/bug-strncat1.c b/string/bug-strncat1.c
new file mode 100644
index 0000000000..0e41a3e727
--- /dev/null
+++ b/string/bug-strncat1.c
@@ -0,0 +1,30 @@
+/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>. */
+#define __USE_STRING_INLINES
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char d[3] = "\0\1\2";
+
+int
+main (void)
+{
+ strncat (d, "\5\6", 1);
+ if (d[0] != '\5')
+ {
+ puts ("d[0] != '\\5'");
+ exit (1);
+ }
+ if (d[1] != '\0')
+ {
+ puts ("d[1] != '\\0'");
+ exit (1);
+ }
+ if (d[2] != '\2')
+ {
+ puts ("d[2] != '\\3'");
+ exit (1);
+ }
+
+ exit (0);
+}