aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-01-23 20:41:36 +0000
committerUlrich Drepper <drepper@redhat.com>2009-01-23 20:41:36 +0000
commit25e84177645ef6e640037e5f4b69ff0ac13d31cc (patch)
treea9a540da995a98ae85e5214bb64547dc6d836289 /misc
parent8073a49484461fbf71cacb154cc2aa2cdac0cca2 (diff)
downloadglibc-25e84177645ef6e640037e5f4b69ff0ac13d31cc.zip
glibc-25e84177645ef6e640037e5f4b69ff0ac13d31cc.tar.gz
glibc-25e84177645ef6e640037e5f4b69ff0ac13d31cc.tar.bz2
..
2009-01-23 Ulrich Drepper <drepper@redhat.com> * 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.
Diffstat (limited to 'misc')
-rw-r--r--misc/Makefile4
-rw-r--r--misc/bug-hsearch1.c31
2 files changed, 33 insertions, 2 deletions
diff --git a/misc/Makefile b/misc/Makefile
index eb97ac1..a256068 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 0000000..6097b5a
--- /dev/null
+++ b/misc/bug-hsearch1.c
@@ -0,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"