From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10612 invoked by alias); 26 Mar 2004 22:13:43 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 10595 invoked from network); 26 Mar 2004 22:13:42 -0000 Received: from unknown (HELO Cantor.suse.de) (195.135.220.2) by sources.redhat.com with SMTP; 26 Mar 2004 22:13:42 -0000 Received: from hermes.suse.de (Hermes.suse.de [195.135.221.8]) (using TLSv1 with cipher EDH-RSA-DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by Cantor.suse.de (Postfix) with ESMTP id 1C04E37E19F for ; Fri, 26 Mar 2004 23:13:42 +0100 (CET) Date: Sat, 27 Mar 2004 17:53:00 -0000 From: Thorsten Kukuk To: libc-hacker@sources.redhat.com Subject: NSS modules and errno if key not found Message-ID: <20040326221341.GA14167@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Organization: SuSE Linux AG, Nuernberg, Germany X-SW-Source: 2004-03/txt/msg00137.txt.bz2 Hi, I found a problem today when debugging some NSS releated problems. If somebody calls getgrnam_r (or any other reentrant NSS function), the return value of the function will be errno if the status is not NSS_STATUS_SUCCESS. But in the case of NSS_STATUS_NOTFOUND, no NSS module sets errno, so the return value is a random value, but should be zero. Who should set errno in this case? Should all NSS modules set errno? Or should we explicit return 0 in the getXXbyYY_r functions for NSS_STATUS_NOTFOUND? Testcase: #include #include int main () { char buffer[8048]; struct group *result = (void *)12, gbuf; errno = 211; int ret = getgrnam_r ("notexistent", &gbuf, buffer, sizeof (buffer), &result); printf ("errno=%d, ret=%d, result=%p\n", errno, ret, result); return 0; } -- Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de SuSE Linux AG Maxfeldstr. 5 D-90409 Nuernberg -------------------------------------------------------------------- Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B