public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Make /etc/default/nss reading errno preserving
Date: Tue, 03 Jul 2007 13:20:00 -0000	[thread overview]
Message-ID: <20070703132242.GG4603@sunsite.mff.cuni.cz> (raw)

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  <jakub@redhat.com>

	[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 <ctype.h>
+#include <errno.h>
 #include <stdio.h>
 #include <stdio_ext.h>
 #include <stdlib.h>
@@ -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

                 reply	other threads:[~2007-07-03 13:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070703132242.GG4603@sunsite.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).