about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-07-28 20:45:36 +0000
committerUlrich Drepper <drepper@redhat.com>2007-07-28 20:45:36 +0000
commitcedb4109571cff4416235df260848de77f09f556 (patch)
treee170e2abca7478ed85d71a5efe34f861a112b90a
parent9d9febc7952c43f90fd81ce185e4b1a74cb13375 (diff)
downloadglibc-cedb4109571cff4416235df260848de77f09f556.tar.gz
glibc-cedb4109571cff4416235df260848de77f09f556.tar.xz
glibc-cedb4109571cff4416235df260848de77f09f556.zip
* locale/programs/ld-monetary.c (monetary_finish): Avoid range check
	for int_frac_digits and frac_digits.

	* login/logout.c (logout): Avoid aliasing violation.
	* login/logwtmp.c (logwtmp): Likewise.

	* libio/genops.c (_IO_un_link): Avoid aliasing violation.
-rw-r--r--ChangeLog8
-rw-r--r--libio/genops.c18
-rw-r--r--locale/programs/ld-monetary.c8
-rw-r--r--login/logout.c7
-rw-r--r--login/logwtmp.c13
-rw-r--r--nptl/ChangeLog4
6 files changed, 34 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 4dd0649628..15c5e84074 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2007-07-26  Jakub Jelinek  <jakub@redhat.com>
 
+	* locale/programs/ld-monetary.c (monetary_finish): Avoid range check
+	for int_frac_digits and frac_digits.
+
+	* login/logout.c (logout): Avoid aliasing violation.
+	* login/logwtmp.c (logwtmp): Likewise.
+
+	* libio/genops.c (_IO_un_link): Avoid aliasing violation.
+
 	* nscd/selinux.c (preserve_capabilities): Initialize new_caps
 	to avoid warning.
 	* iconv/gconv_open.c (__gconv_open): Initialize ptr to avoid
diff --git a/libio/genops.c b/libio/genops.c
index 3f8d71a50f..7005fdbd96 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -64,23 +64,29 @@ _IO_un_link (fp)
 {
   if (fp->file._flags & _IO_LINKED)
     {
-      struct _IO_FILE_plus **f;
+      struct _IO_FILE **f;
 #ifdef _IO_MTSAFE_IO
       _IO_cleanup_region_start_noarg (flush_cleanup);
       _IO_lock_lock (list_all_lock);
       run_fp = (_IO_FILE *) fp;
       _IO_flockfile ((_IO_FILE *) fp);
 #endif
-      for (f = &INTUSE(_IO_list_all); *f;
-	   f = (struct _IO_FILE_plus **) &(*f)->file._chain)
+      if (INTUSE(_IO_list_all) == NULL)
+	;
+      else if (fp == INTUSE(_IO_list_all))
 	{
-	  if (*f == fp)
+	  INTUSE(_IO_list_all)
+	    = (struct _IO_FILE_plus *) INTUSE(_IO_list_all)->file._chain;
+	  ++_IO_list_all_stamp;
+	}
+      else
+	for (f = &INTUSE(_IO_list_all)->file._chain; *f; f = &(*f)->_chain)
+	  if (*f == (_IO_FILE *) fp)
 	    {
-	      *f = (struct _IO_FILE_plus *) fp->file._chain;
+	      *f = fp->file._chain;
 	      ++_IO_list_all_stamp;
 	      break;
 	    }
-	}
       fp->file._flags &= ~_IO_LINKED;
 #ifdef _IO_MTSAFE_IO
       _IO_funlockfile ((_IO_FILE *) fp);
diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c
index e2634bc2c9..b8d291e7fc 100644
--- a/locale/programs/ld-monetary.c
+++ b/locale/programs/ld-monetary.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1995-1999,2000,2001,2002,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1995-1999,2000,2001,2002,2005,2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -279,13 +280,14 @@ not correspond to a valid name in ISO 4217"),
        monetary->cat = initval;						      \
     }									      \
   else if ((monetary->cat < min || monetary->cat > max)			      \
+	   && min < max							      \
 	   && !be_quiet && !nothing)					      \
     WITH_CUR_LOCALE (error (0, 0, _("\
 %s: value for field `%s' must be in range %d...%d"),			      \
 			    "LC_MONETARY", #cat, min, max))
 
-  TEST_ELEM (int_frac_digits, -128, 127, -1);
-  TEST_ELEM (frac_digits, -128, 127, -1);
+  TEST_ELEM (int_frac_digits, 1, 0, -1);
+  TEST_ELEM (frac_digits, 1, 0, -1);
   TEST_ELEM (p_cs_precedes, -1, 1, -1);
   TEST_ELEM (p_sep_by_space, -1, 2, -1);
   TEST_ELEM (n_cs_precedes, -1, 1, -1);
diff --git a/login/logout.c b/login/logout.c
index 020ff6189a..8902036c5e 100644
--- a/login/logout.c
+++ b/login/logout.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 2002, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -51,15 +51,10 @@ logout (const char *line)
       bzero (ut->ut_host, sizeof ut->ut_host);
 #endif
 #if _HAVE_UT_TV - 0
-  if (sizeof (ut->ut_tv) == sizeof (struct timeval))
-    __gettimeofday ((struct timeval *) &ut->ut_tv, NULL);
-  else
-    {
       struct timeval tv;
       __gettimeofday (&tv, NULL);
       ut->ut_tv.tv_sec = tv.tv_sec;
       ut->ut_tv.tv_usec = tv.tv_usec;
-    }
 #else
       ut->ut_time = time (NULL);
 #endif
diff --git a/login/logwtmp.c b/login/logwtmp.c
index 96ef05d795..ff2e7f9887 100644
--- a/login/logwtmp.c
+++ b/login/logwtmp.c
@@ -44,15 +44,10 @@ logwtmp (const char *line, const char *name, const char *host)
 #endif
 
 #if _HAVE_UT_TV - 0
-  if (sizeof (ut.ut_tv) == sizeof (struct timeval))
-    __gettimeofday ((struct timeval *) &ut.ut_tv, NULL);
-  else
-    {
-      struct timeval tv;
-      __gettimeofday (&tv, NULL);
-      ut.ut_tv.tv_sec = tv.tv_sec;
-      ut.ut_tv.tv_usec = tv.tv_usec;
-    }
+  struct timeval tv;
+  __gettimeofday (&tv, NULL);
+  ut.ut_tv.tv_sec = tv.tv_sec;
+  ut.ut_tv.tv_usec = tv.tv_usec;
 #else
   ut.ut_time = time (NULL);
 #endif
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 84681bb334..9b5a1baa68 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,7 @@
+2007-07-26  Jakub Jelinek  <jakub@redhat.com>
+
+	* tst-locale2.c (useless): Add return statement.
+
 2007-07-24  Jakub Jelinek  <jakub@redhat.com>
 
 	* allocatestack.c (__nptl_setxid, __wait_lookup_done): Replace