From 25e84177645ef6e640037e5f4b69ff0ac13d31cc Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 23 Jan 2009 20:41:36 +0000 Subject: [PATCH] .. 2009-01-23 Ulrich Drepper * 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. --- ChangeLog | 9 +++++++++ misc/Makefile | 4 ++-- misc/bug-hsearch1.c | 31 +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/tst-clone.c | 6 +++--- 4 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 misc/bug-hsearch1.c diff --git a/ChangeLog b/ChangeLog index 5ffa07f9c5..673f4e5502 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-01-23 Ulrich Drepper + + * 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 * Makeconfig (%.v.i): Strip trailing # comments, diff --git a/misc/Makefile b/misc/Makefile index eb97ac1767..a256068c2b 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -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 @@ endif 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 diff --git a/misc/bug-hsearch1.c b/misc/bug-hsearch1.c new file mode 100644 index 0000000000..6097b5ad04 --- /dev/null +++ b/misc/bug-hsearch1.c @@ -0,0 +1,31 @@ +#include +#include + +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" diff --git a/sysdeps/unix/sysv/linux/tst-clone.c b/sysdeps/unix/sysv/linux/tst-clone.c index 8e249c2f04..cbfa8917d6 100644 --- a/sysdeps/unix/sysv/linux/tst-clone.c +++ b/sysdeps/unix/sysv/linux/tst-clone.c @@ -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 @@ do_test (void) 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)