[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r3789 - in /fsf/trunk/libc: ./ elf/ libio/ locale/programs/ misc/ posix/



Author: eglibc
Date: Sat Oct 13 00:03:54 2007
New Revision: 3789

Log:
Import glibc-mainline for 2007-10-13

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/elf/cache.c
    fsf/trunk/libc/libio/__freading.c
    fsf/trunk/libc/locale/programs/ld-collate.c
    fsf/trunk/libc/locale/programs/repertoire.c
    fsf/trunk/libc/misc/Makefile
    fsf/trunk/libc/posix/fnmatch_loop.c
    fsf/trunk/libc/posix/regcomp.c
    fsf/trunk/libc/posix/regexec.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Oct 13 00:03:54 2007
@@ -1,3 +1,25 @@
+2007-10-12  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* locale/programs/repertoire.c (repertoire_read): Always free
+	memory for repertoire file name [Coverity CID 270].
+
+	* elf/cache.c (save_aux_cache): Free memory allocated for
+	temporary file name [Coverity CID 267].
+
+2007-10-12  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* misc/Makefile (headers): Add bits/error.h.
+
+2007-10-12  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* posix/fnmatch_loop.c: Take rule index returned as part of
+	findidx return value into account when accessing weights.
+	* posix/regcomp.c: Likewise.
+	* posix/regexec.c: Likewise.
+
+	* locale/programs/ld-collate.c (collate_read): Optimize a bit.
+	(skip_to): Fix problems with parameter of elifdef/elifndef.
+
 2007-10-11  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* iconv/gconv_simple.c: Add some branch prediction.

Modified: fsf/trunk/libc/elf/cache.c
==============================================================================
--- fsf/trunk/libc/elf/cache.c (original)
+++ fsf/trunk/libc/elf/cache.c Sat Oct 13 00:03:54 2007
@@ -800,5 +800,6 @@
 
 out_fail:
   /* Free allocated memory.  */
+  free (temp_name);
   free (file_entries);
 }

Modified: fsf/trunk/libc/libio/__freading.c
==============================================================================
--- fsf/trunk/libc/libio/__freading.c (original)
+++ fsf/trunk/libc/libio/__freading.c Sat Oct 13 00:03:54 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2002, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
 int
 __freading (FILE *fp)
 {
-  return ((fp->_flags & _IO_NO_WRITES)
-	  || (fp->_flags & _IO_CURRENTLY_PUTTING) == 0);
+  return (((fp->_flags & _IO_NO_WRITES)
+	   || (fp->_flags & _IO_CURRENTLY_PUTTING) == 0)
+	  && (fp->_flags & _IO_NO_READS) == 0);
 }

Modified: fsf/trunk/libc/locale/programs/ld-collate.c
==============================================================================
--- fsf/trunk/libc/locale/programs/ld-collate.c (original)
+++ fsf/trunk/libc/locale/programs/ld-collate.c Sat Oct 13 00:03:54 2007
@@ -2662,11 +2662,14 @@
 	  if (nowtok == tok_eof || nowtok == tok_end)
 	    return nowtok;
 	}
-      else if ((!to_endif && (nowtok == tok_else || nowtok == tok_elifdef
-			      || nowtok == tok_elifndef))
-	       || nowtok == tok_endif)
+      else if (nowtok == tok_endif || (!to_endif && nowtok == tok_else))
 	{
 	  lr_ignore_rest (ldfile, 1);
+	  return nowtok;
+	}
+      else if (!to_endif && (nowtok == tok_elifdef || nowtok == tok_elifndef))
+	{
+	  /* Do not read the rest of the line.  */
 	  return nowtok;
 	}
       else if (nowtok == tok_else)
@@ -2709,15 +2712,18 @@
   /* The rest of the line containing `LC_COLLATE' must be free.  */
   lr_ignore_rest (ldfile, 1);
 
-  do
-    {
-      now = lr_token (ldfile, charmap, result, NULL, verbose);
-      nowtok = now->tok;
-    }
-  while (nowtok == tok_eol);
-
-  while (nowtok == tok_define)
-    {
+  while (1)
+    {
+      do
+	{
+	  now = lr_token (ldfile, charmap, result, NULL, verbose);
+	  nowtok = now->tok;
+	}
+      while (nowtok == tok_eol);
+
+      if (nowtok != tok_define)
+	break;
+
       if (ignore_content)
 	lr_ignore_rest (ldfile, 0);
       else
@@ -2738,13 +2744,6 @@
 	      lr_ignore_rest (ldfile, 1);
 	    }
 	}
-
-      do
-	{
-	  now = lr_token (ldfile, charmap, result, NULL, verbose);
-	  nowtok = now->tok;
-	}
-      while (nowtok == tok_eol);
     }
 
   if (nowtok == tok_copy)

Modified: fsf/trunk/libc/locale/programs/repertoire.c
==============================================================================
--- fsf/trunk/libc/locale/programs/repertoire.c (original)
+++ fsf/trunk/libc/locale/programs/repertoire.c Sat Oct 13 00:03:54 2007
@@ -113,8 +113,7 @@
 		      filename);
 	      repfile = lr_open (buf, repertoiremap_hash);
 
-	      if (repfile == NULL)
-		free (buf);
+	      free (buf);
 	    }
 	}
 

Modified: fsf/trunk/libc/misc/Makefile
==============================================================================
--- fsf/trunk/libc/misc/Makefile (original)
+++ fsf/trunk/libc/misc/Makefile Sat Oct 13 00:03:54 2007
@@ -31,7 +31,7 @@
 	   sys/select.h ustat.h sys/ustat.h bits/ustat.h sys/sysinfo.h \
 	   regexp.h bits/select.h bits/mman.h sys/xattr.h \
 	   syslog.h sys/syslog.h \
-	   bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h
+	   bits/syslog.h bits/syslog-ldbl.h bits/syslog-path.h bits/error.h
 
 routines := brk sbrk sstk ioctl \
 	    readv writev \

Modified: fsf/trunk/libc/posix/fnmatch_loop.c
==============================================================================
--- fsf/trunk/libc/posix/fnmatch_loop.c (original)
+++ fsf/trunk/libc/posix/fnmatch_loop.c Sat Oct 13 00:03:54 2007
@@ -1,5 +1,5 @@
-/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2003,2004,2005,
-   2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1993,1996-2001,2003-2005,2007
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -418,14 +418,19 @@
 			    /* We found a table entry.  Now see whether the
 			       character we are currently at has the same
 			       equivalance class value.  */
-			    int len = weights[idx];
+			    int len = weights[idx & 0xffffff];
 			    int32_t idx2;
 			    const UCHAR *np = (const UCHAR *) n;
 
 			    idx2 = findidx (&np);
-			    if (idx2 != 0 && len == weights[idx2])
+			    if (idx2 != 0
+				&& (idx >> 24) == (idx2 >> 24)
+				&& len == weights[idx2 & 0xffffff])
 			      {
 				int cnt = 0;
+
+				idx &= 0xffffff;
+				idx2 &= 0xffffff;
 
 				while (cnt < len
 				       && (weights[idx + 1 + cnt]

Modified: fsf/trunk/libc/posix/regcomp.c
==============================================================================
--- fsf/trunk/libc/posix/regcomp.c (original)
+++ fsf/trunk/libc/posix/regcomp.c Sat Oct 13 00:03:54 2007
@@ -3378,7 +3378,7 @@
 
       /* Build single byte matcing table for this equivalence class.  */
       char_buf[1] = (unsigned char) '\0';
-      len = weights[idx1];
+      len = weights[idx1 & 0xffffff];
       for (ch = 0; ch < SBC_MAX; ++ch)
 	{
 	  char_buf[0] = ch;
@@ -3390,11 +3390,15 @@
 	  if (idx2 == 0)
 	    /* This isn't a valid character.  */
 	    continue;
-	  if (len == weights[idx2])
+	  /* Compare only if the length matches and the collation rule
+	     index is the same.  */
+	  if (len == weights[idx2 & 0xffffff] && (idx1 >> 24) == (idx2 >> 24))
 	    {
 	      int cnt = 0;
+
 	      while (cnt <= len &&
-		     weights[idx1 + 1 + cnt] == weights[idx2 + 1 + cnt])
+		     weights[(idx1 & 0xffffff) + 1 + cnt]
+		     == weights[(idx2 & 0xffffff) + 1 + cnt])
 		++cnt;
 
 	      if (cnt > len)

Modified: fsf/trunk/libc/posix/regexec.c
==============================================================================
--- fsf/trunk/libc/posix/regexec.c (original)
+++ fsf/trunk/libc/posix/regexec.c Sat Oct 13 00:03:54 2007
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <isamu@xxxxxxxxxxxxxx>.
 
@@ -3825,7 +3825,6 @@
 	  const int32_t *table, *indirect;
 	  const unsigned char *weights, *extra;
 	  const char *collseqwc;
-	  int32_t idx;
 	  /* This #include defines a local function!  */
 #  include <locale/weight.h>
 
@@ -3883,15 +3882,20 @@
 		_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
 	      indirect = (const int32_t *)
 		_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
-	      idx = findidx (&cp);
+	      int32_t idx = findidx (&cp);
 	      if (idx > 0)
 		for (i = 0; i < cset->nequiv_classes; ++i)
 		  {
 		    int32_t equiv_class_idx = cset->equiv_classes[i];
-		    size_t weight_len = weights[idx];
-		    if (weight_len == weights[equiv_class_idx])
+		    size_t weight_len = weights[idx & 0xffffff];
+		    if (weight_len == weights[equiv_class_idx & 0xffffff]
+			&& (idx >> 24) == (equiv_class_idx >> 24))
 		      {
 			int cnt = 0;
+
+			idx &= 0xffffff;
+			equiv_class_idx &= 0xffffff;
+
 			while (cnt <= weight_len
 			       && (weights[equiv_class_idx + 1 + cnt]
 				   == weights[idx + 1 + cnt]))