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

[commits] r7787 - in /fsf/trunk/libc: ChangeLog misc/Makefile misc/bug-hsearch1.c misc/hsearch_r.c sysdeps/unix/sysv/linux/tst-clone.c



Author: eglibc
Date: Sat Jan 24 00:03:36 2009
New Revision: 7787

Log:
Import glibc-mainline for 2009-01-24

Added:
    fsf/trunk/libc/misc/bug-hsearch1.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/misc/Makefile
    fsf/trunk/libc/misc/hsearch_r.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/tst-clone.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Jan 24 00:03:36 2009
@@ -1,3 +1,12 @@
+2009-01-23  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/tst-clone.c (do_test): Avoid warning.
+
+	* misc/hsearch_r.c (hcreate_r): We need at least three elements in
+	the hash table.
+	* misc/Makefile (tests): Add bug-hsearch1.
+	* misc/bug-hsearch1.c: New file.
+
 2009-01-22  Roland McGrath  <roland@xxxxxxxxxx>
 
 	* Makeconfig (%.v.i): Strip trailing # comments,

Modified: fsf/trunk/libc/misc/Makefile
==============================================================================
--- fsf/trunk/libc/misc/Makefile (original)
+++ fsf/trunk/libc/misc/Makefile Sat Jan 24 00:03:36 2009
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1991-2006, 2007, 2009 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
@@ -79,7 +79,7 @@
 gpl2lgpl := error.c error.h
 
 tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
-	 tst-error1 tst-pselect tst-insremque tst-mntent2
+	 tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
 ifeq (no,$(cross-compiling))
 tests: $(objpfx)tst-error1-mem
 endif

Added: fsf/trunk/libc/misc/bug-hsearch1.c
==============================================================================
--- fsf/trunk/libc/misc/bug-hsearch1.c (added)
+++ fsf/trunk/libc/misc/bug-hsearch1.c Sat Jan 24 00:03:36 2009
@@ -1,0 +1,31 @@
+#include <search.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+  if (hcreate (1) == 0)
+    {
+      puts ("hcreate failed");
+      return 1;
+    }
+  ENTRY e;
+  e.key = (char *) "a";
+  e.data = (char *) "b";
+  if (hsearch (e, ENTER) == NULL)
+    {
+      puts ("ENTER failed");
+      return 1;
+    }
+  ENTRY s;
+  s.key = (char *) "c";
+  if (hsearch (s, FIND) != NULL)
+    {
+      puts ("FIND succeeded");
+      return 1;
+    }
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/misc/hsearch_r.c
==============================================================================
--- fsf/trunk/libc/misc/hsearch_r.c (original)
+++ fsf/trunk/libc/misc/hsearch_r.c Sat Jan 24 00:03:36 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,1995-1997,2002,2005,2007,2008
+/* Copyright (C) 1993,1995-1997,2002,2005,2007,2008,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxxxxxx>, 1993.
@@ -79,6 +79,10 @@
   if (htab->table != NULL)
     return 0;
 
+  /* We need a size of at least 3.  Otherwise the hash functions we
+     use will not work.  */
+  if (nel < 3)
+    nel = 3;
   /* Change nel to the first prime number not smaller as nel. */
   nel |= 1;      /* make odd */
   while (!isprime (nel))

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/tst-clone.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/tst-clone.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/tst-clone.c Sat Jan 24 00:03:36 2009
@@ -1,5 +1,5 @@
 /* Test for proper error/errno handling in clone.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009 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
@@ -36,9 +36,9 @@
   int result;
 
 #ifdef __ia64__
-  result = __clone2(child_fn, NULL, 0, 0, NULL, NULL, NULL);
+  result = __clone2 (child_fn, NULL, 0, 0, NULL, NULL, NULL);
 #else
-  result = clone(child_fn, NULL, (int) NULL, NULL);
+  result = clone (child_fn, NULL, 0, NULL);
 #endif
 
   if (errno != EINVAL || result != -1)