glibc/misc/bug-hsearch1.c
Ulrich Drepper 25e8417764 ..
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.
2009-01-23 20:41:36 +00:00

32 lines
507 B
C

#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"