From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6963 invoked by alias); 3 Jul 2007 13:20:28 -0000 Received: (qmail 6946 invoked by uid 22791); 3 Jul 2007 13:20:27 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 03 Jul 2007 13:20:23 +0000 Received: from sunsite.mff.cuni.cz (localhost.localdomain [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id l63DMgNu003401; Tue, 3 Jul 2007 15:22:42 +0200 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.13.8/8.13.8/Submit) id l63DMgIS003400; Tue, 3 Jul 2007 15:22:42 +0200 Date: Tue, 03 Jul 2007 13:20:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Make /etc/default/nss reading errno preserving Message-ID: <20070703132242.GG4603@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00000.txt.bz2 Hi! _nsl_default_nss is called indirectly even from functions which should preserve errno in certain cases (e.g. getpwent if it returns NULL should only set errno in case of error). But presence of /etc/default/nss or lack thereof should not be considered an error. 2007-07-03 Jakub Jelinek [BZ #4702] * nis/nss-default.c: Include errno.h. (init): Preserve errno. --- libc/nis/nss-default.c.jj 2006-04-28 23:03:17.000000000 +0200 +++ libc/nis/nss-default.c 2007-07-03 14:59:57.000000000 +0200 @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 2001, 2004, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1996, 2001, 2004, 2006, 2007 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 @@ -17,6 +17,7 @@ 02111-1307 USA. */ #include +#include #include #include #include @@ -54,6 +55,7 @@ static const struct static void init (void) { + int saved_errno = errno; FILE *fp = fopen (default_nss, "rc"); if (fp != NULL) { @@ -111,6 +113,7 @@ init (void) fclose (fp); } + __set_errno (saved_errno); } Jakub