Commit a5ffa8fe authored by Tom Lane's avatar Tom Lane

Guard against bug in Solaris' bsearch(), per Michael Wildpaner.

parent a5a68766
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.117 2003/11/29 19:51:49 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.118 2003/12/05 15:50:31 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -381,6 +381,10 @@ user_group_bsearch_cmp(const void *user, const void *list)
static List **
get_group_line(const char *group)
{
/* On some versions of Solaris, bsearch of zero items dumps core */
if (group_length == 0)
return NULL;
return (List **) bsearch((void *) group,
(void *) group_sorted,
group_length,
......@@ -395,6 +399,10 @@ get_group_line(const char *group)
List **
get_user_line(const char *user)
{
/* On some versions of Solaris, bsearch of zero items dumps core */
if (user_length == 0)
return NULL;
return (List **) bsearch((void *) user,
(void *) user_sorted,
user_length,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment