about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-07-25 06:37:56 +0000
committerJakub Jelinek <jakub@redhat.com>2005-07-25 06:37:56 +0000
commit14c3168379a44102adc58f0a6e88fbb269fe0ec8 (patch)
treec5a6e7c6a272066cc25763c0006a53ad6a914a4c
parentdcb585f3e5b09ebd7ae92c0c8ed602c3f3e44b61 (diff)
downloadglibc-14c3168379a44102adc58f0a6e88fbb269fe0ec8.tar.gz
glibc-14c3168379a44102adc58f0a6e88fbb269fe0ec8.tar.xz
glibc-14c3168379a44102adc58f0a6e88fbb269fe0ec8.zip
Updated to fedora-glibc-20050725T0627
-rw-r--r--ChangeLog35
-rw-r--r--fedora/branch.mk4
-rw-r--r--posix/Makefile2
-rw-r--r--posix/execvp.c10
-rw-r--r--posix/tst-execvp4.c35
-rw-r--r--stdio-common/fxprintf.c4
-rw-r--r--string/test-memset.c16
-rw-r--r--sysdeps/sh/memset.S1
-rw-r--r--wcsmbs/Makefile3
-rw-r--r--wcsmbs/bits/wchar2.h16
-rw-r--r--wcsmbs/tst-wchar-h.c9
11 files changed, 108 insertions, 27 deletions
diff --git a/ChangeLog b/ChangeLog
index bff2235116..b1b0d10097 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2005-07-24  Ulrich Drepper  <drepper@redhat.com>
+
+	* string/test-memset.c (test_main): Use negative byte value is
+	test.
+
+	* string/test-memset.c (do_one_test): Compare effect of call, not
+	only return value.
+	Add a few casts to avoid warnings.
+
+2005-07-24  SUGIOKA Toshinobu  <sugioka@itonet.co.jp>
+
+	* sysdeps/sh/memset.S (memset): Correct 2nd argument handling.
+
+2005-07-24  Ulrich Drepper  <drepper@redhat.com>
+
+	[BZ #1125]
+	* posix/Makefile (tests): Add tst-execvp4.
+	* posix/tst-execvp4.c: New file.
+
+2005-07-24  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #1125]
+	* posix/execvp.c (execvp): Change path_malloc to
+	char *, free that pointer on failure.
+
+2005-07-24  Ulrich Drepper  <drepper@redhat.com>
+
+	* wcsmbs/bits/wchar2.h: Use __FILE not FILE.
+	* wcsmbs/Makefile: Add rules to build and run tst-wchar-h.
+	* wcsmbs/tst-wchar-h.c: New file.
+
+2005-07-22  Ulrich Drepper  <drepper@redhat.com>
+
+	* stdio-common/fxprintf.c (__fxprintf): Define variable more local.
+
 2005-07-22  Jakub Jelinek  <jakub@redhat.com>
 
 	* wcsmbs/bits/wchar2.h (__vfwprintf_chk, __vwprintf_chk): Use
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 1c1feacc42..008f73de9a 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
 glibc-base := HEAD
 DIST_BRANCH := devel
 COLLECTION := dist-fc4
-fedora-sync-date := 2005-07-22 04:33 UTC
-fedora-sync-tag := fedora-glibc-20050722T0433
+fedora-sync-date := 2005-07-25 06:27 UTC
+fedora-sync-tag := fedora-glibc-20050725T0627
diff --git a/posix/Makefile b/posix/Makefile
index f6b6aefbe0..cabc1d44d0 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -87,7 +87,7 @@ tests		:= tstgetopt testfnm runtests runptests	     \
 		   tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
 		   tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
 		   tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
-		   tst-execvp3
+		   tst-execvp3 tst-execvp4
 xtests		:= bug-ga2
 ifeq (yes,$(build-shared))
 test-srcs	:= globtest
diff --git a/posix/execvp.c b/posix/execvp.c
index 6f4e4b8566..8421bd048f 100644
--- a/posix/execvp.c
+++ b/posix/execvp.c
@@ -88,7 +88,7 @@ execvp (file, argv)
   else
     {
       char *path = getenv ("PATH");
-      bool path_malloc = false;
+      char *path_malloc = NULL;
       if (path == NULL)
 	{
 	  /* There is no `PATH' in the environment.
@@ -100,7 +100,7 @@ execvp (file, argv)
 	    return -1;
 	  path[0] = ':';
 	  (void) confstr (_CS_PATH, path + 1, len);
-	  path_malloc = true;
+	  path_malloc = path;
 	}
 
       size_t len = strlen (file) + 1;
@@ -108,8 +108,7 @@ execvp (file, argv)
       char *name = malloc (pathlen + len + 1);
       if (name == NULL)
 	{
-	  if (path_malloc)
-	    free (path);
+	  free (path_malloc);
 	  return -1;
 	}
       /* Copy the file name at the top.  */
@@ -190,8 +189,7 @@ execvp (file, argv)
 
       free (script_argv);
       free (name - pathlen);
-      if (path_malloc)
-	free (path);
+      free (path_malloc);
     }
 
   /* Return the error from the last attempt (probably ENOENT).  */
diff --git a/posix/tst-execvp4.c b/posix/tst-execvp4.c
new file mode 100644
index 0000000000..531fab227b
--- /dev/null
+++ b/posix/tst-execvp4.c
@@ -0,0 +1,35 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+static int
+do_test (void)
+{
+  char buf[40] = "/usr/bin/does-not-exist";
+  size_t stemlen = strlen (buf);
+  struct stat64 st;
+  int cnt = 0;
+  while (stat64 (buf, &st) != -1 || errno != ENOENT
+	 || stat64 (buf + 4, &st) != -1 || errno != ENOENT)
+    {
+      if (cnt++ == 100)
+	{
+	  puts ("cannot find a unique file name");
+	  return 0;
+	}
+
+      strcpy (buf + stemlen, ".XXXXXX");
+      mktemp (buf);
+    }
+
+  unsetenv ("PATH");
+  char *argv[] = { buf + 9, NULL };
+  execvp (argv[0], argv);
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/stdio-common/fxprintf.c b/stdio-common/fxprintf.c
index 3b3cc5cdda..6fecb31fb7 100644
--- a/stdio-common/fxprintf.c
+++ b/stdio-common/fxprintf.c
@@ -37,9 +37,9 @@ __fxprintf (FILE *fp, const char *fmt, ...)
   int res;
   if (_IO_fwide (fp, 0) > 0)
     {
-      size_t len = strlen (fmt) + 1, i;
+      size_t len = strlen (fmt) + 1;
       wchar_t wfmt[len];
-      for (i = 0; i < len; ++i)
+      for (size_t i = 0; i < len; ++i)
 	{
 	  assert (isascii (fmt[i]));
 	  wfmt[i] = fmt[i];
diff --git a/string/test-memset.c b/string/test-memset.c
index 9ae774162f..601ace4195 100644
--- a/string/test-memset.c
+++ b/string/test-memset.c
@@ -1,5 +1,5 @@
 /* Test and measure memset functions.
-   Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -49,10 +49,12 @@ static void
 do_one_test (impl_t *impl, char *s, int c, size_t n)
 {
   char *res = CALL (impl, s, c, n);
-  if (res != s)
+  char tstbuf[n];
+  if (res != s
+      || simple_memset (tstbuf, c, n) != tstbuf
+      || memcmp (s, tstbuf, n) != 0)
     {
-      error (0, 0, "Wrong result in function %s %p != %p", impl->name,
-	     res, s);
+      error (0, 0, "Wrong result in function %s", impl->name);
       ret = 1;
       return;
     }
@@ -87,7 +89,7 @@ do_test (size_t align, int c, size_t len)
     printf ("Length %4zd, alignment %2zd, c %2d:", len, align, c);
 
   FOR_EACH_IMPL (impl, 0)
-    do_one_test (impl, buf1 + align, c, len);
+    do_one_test (impl, (char *) buf1 + align, c, len);
 
   if (HP_TIMING_AVAIL)
     putchar ('\n');
@@ -143,7 +145,7 @@ do_random_tests (void)
 	      if (p[i + align] == c)
 		p[i + align] = o;
 	    }
-	  res = CALL (impl, p + align, c, len);
+	  res = (unsigned char *) CALL (impl, (char *) p + align, c, len);
 	  if (res != p + align)
 	    {
 	      error (0, 0, "Iteration %zd - wrong result in function %s (%zd, %d, %zd) %p != %p",
@@ -191,7 +193,7 @@ test_main (void)
     printf ("\t%s", impl->name);
   putchar ('\n');
 
-  for (c = 0; c <= 65; c += 65)
+  for (c = -65; c <= 130; c += 65)
     {
       for (i = 0; i < 18; ++i)
 	do_test (0, c, 1 << i);
diff --git a/sysdeps/sh/memset.S b/sysdeps/sh/memset.S
index ca23449367..9a8e2efd96 100644
--- a/sysdeps/sh/memset.S
+++ b/sysdeps/sh/memset.S
@@ -28,6 +28,7 @@ ENTRY(memset)
 	bt.s	L_byte_loop_init
 	mov	r4,r7
 
+	extu.b	r5,r5
 	swap.b	r5,r1
 	or	r1,r5
 	swap.w	r5,r1
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index d033de931c..78b3e5b4e7 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -40,7 +40,7 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
 	    wcsmbsload mbsrtowcs_l
 
 tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen tst-btowc tst-mbrtowc \
-	 tst-wcrtomb tst-wcpncpy tst-mbsrtowcs
+	 tst-wcrtomb tst-wcpncpy tst-mbsrtowcs tst-wchar-h
 
 include ../Rules
 
@@ -62,6 +62,7 @@ CFLAGS-wcstoull_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstod_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstold_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstof_l.c = $(strtox-CFLAGS)
+CFLAGS-tst-wchar-h.c = -D_FORTIFY_SOURCE=2
 
 tst-btowc-ENV = LOCPATH=$(common-objpfx)localedata
 tst-mbrtowc-ENV = LOCPATH=$(common-objpfx)localedata
diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h
index 29bfad0110..5e6396f048 100644
--- a/wcsmbs/bits/wchar2.h
+++ b/wcsmbs/bits/wchar2.h
@@ -230,11 +230,11 @@ vswprintf (wchar_t *__s, size_t __n, __const wchar_t *__format,
 
 #if __USE_FORTIFY_LEVEL > 1
 
-extern int __fwprintf_chk (FILE *__restrict __stream, int __flag,
+extern int __fwprintf_chk (__FILE *__restrict __stream, int __flag,
 			   __const wchar_t *__restrict __format, ...);
 extern int __wprintf_chk (int __flag, __const wchar_t *__restrict __format,
 			  ...);
-extern int __vfwprintf_chk (FILE *__restrict __stream, int __flag,
+extern int __vfwprintf_chk (__FILE *__restrict __stream, int __flag,
 			    __const wchar_t *__restrict __format,
 			    __gnuc_va_list __ap);
 extern int __vwprintf_chk (int __flag, __const wchar_t *__restrict __format,
@@ -252,13 +252,13 @@ extern int __vwprintf_chk (int __flag, __const wchar_t *__restrict __format,
 #endif
 
 extern wchar_t *__fgetws_chk (wchar_t *__restrict __s, size_t __size, int __n,
-			      FILE *__restrict __stream) __wur;
+			      __FILE *__restrict __stream) __wur;
 extern wchar_t *__REDIRECT (__fgetws_alias,
 			    (wchar_t *__restrict __s, int __n,
-			     FILE *__restrict __stream), fgetws) __wur;
+			     __FILE *__restrict __stream), fgetws) __wur;
 
 extern __always_inline __wur wchar_t *
-fgetws (wchar_t *__restrict __s, int __n, FILE *__restrict __stream)
+fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
 {
   if (__bos (__s) != (size_t) -1
       && (!__builtin_constant_p (__n) || (size_t) __n > __bos (__s)))
@@ -268,15 +268,15 @@ fgetws (wchar_t *__restrict __s, int __n, FILE *__restrict __stream)
 
 #ifdef __USE_GNU
 extern wchar_t *__fgetws_unlocked_chk (wchar_t *__restrict __s, size_t __size,
-				       int __n, FILE *__restrict __stream)
+				       int __n, __FILE *__restrict __stream)
   __wur;
 extern wchar_t *__REDIRECT (__fgetws_unlocked_alias,
 			    (wchar_t *__restrict __s, int __n,
-			     FILE *__restrict __stream), fgetws_unlocked)
+			     __FILE *__restrict __stream), fgetws_unlocked)
   __wur;
 
 extern __always_inline __wur wchar_t *
-fgetws_unlocked (wchar_t *__restrict __s, int __n, FILE *__restrict __stream)
+fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream)
 {
   if (__bos (__s) != (size_t) -1
       && (!__builtin_constant_p (__n) || (size_t) __n > __bos (__s)))
diff --git a/wcsmbs/tst-wchar-h.c b/wcsmbs/tst-wchar-h.c
new file mode 100644
index 0000000000..4cf2dd0690
--- /dev/null
+++ b/wcsmbs/tst-wchar-h.c
@@ -0,0 +1,9 @@
+#include <stdlib.h>
+#include <wchar.h>
+
+int
+main (void)
+{
+  mbstate_t x;
+  return sizeof (x) - sizeof (mbstate_t);
+}