NetBSD-Bugs archive

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

bin/51957: hsearch_r on NetBSD has opposite behavior compared to Linux



>Number:         51957
>Category:       bin
>Synopsis:       hsearch_r on NetBSD has opposite behavior compared to Linux
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 07 02:00:00 +0000 2017
>Originator:     Ngie Cooper
>Release:        7.x
>Organization:
>Environment:
n/a
>Description:
The lib/libc/stdlib/t_hsearch.c:nonexistent testcase tests hsearch_r to make sure it fails when creating a hash search table, then checks to make sure that a proper error is returned when looking for a non-ENTER'ed key.

The error code behavior on NetBSD is opposite of Linux. The Linux behavior seems more consistent with standard expectations for lib call return codes, but at the very least I figured it should be documented. From https://linux.die.net/man/3/hsearch_r :

On success, hsearch() returns a pointer to an entry in the hash table. hsearch() returns NULL on error, that is, if action is ENTER and the hash table is full, or action is FIND and item cannot be found in the hash table. hsearch_r() returns nonzero on success, and 0 on error.
>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index