about summary refs log tree commit diff
path: root/libio/genops.c
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 /libio/genops.c
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.
Diffstat (limited to 'libio/genops.c')
-rw-r--r--libio/genops.c18
1 files changed, 12 insertions, 6 deletions
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);