Skip to content

Commit

Permalink
* nis/nis_call.c (nis_server_cache_search): Save errno around stat
Browse files Browse the repository at this point in the history
	call.
	(__nisfind_server): Similar for open readColdStartFile call.
	Patch partially by Jim Meyering.
	* nss/nss_files/files-XXX.c (_nss_files_getXXent_r): Save errno
	around internal_setent call.
  • Loading branch information
Ulrich Drepper committed Mar 24, 2008
1 parent 7e570c5 commit 0facd3d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
2008-03-24 Ulrich Drepper <drepper@redhat.com>

* nis/nis_call.c (nis_server_cache_search): Save errno around stat
call.
(__nisfind_server): Similar for open readColdStartFile call.
Patch partially by Jim Meyering.
* nss/nss_files/files-XXX.c (_nss_files_getXXent_r): Save errno
around internal_setent call.

* po/vi.po: New Vietnamese translation.

* sysdeps/unix/sysv/linux/adjtime.c: Correctly use
Expand Down
6 changes: 5 additions & 1 deletion nis/nis_call.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2001, 2004, 2005, 2006, 2007
/* Copyright (C) 1997, 1998, 2001, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
Expand Down Expand Up @@ -592,8 +592,10 @@ nis_server_cache_search (const_nis_name name, int search_parent,
XDR xdrs;
struct stat64 st;

int saved_errno = errno;
if (stat64 ("/var/nis/NIS_COLD_START", &st) < 0)
st.st_mtime = nis_cold_start_mtime + 1;
__set_errno (saved_errno);

__libc_lock_lock (nis_server_cache_lock);

Expand Down Expand Up @@ -741,7 +743,9 @@ __nisfind_server (const_nis_name name, int search_parent,
return result;
}

int saved_errno = errno;
*dir = readColdStartFile ();
__set_errno (saved_errno);
if (*dir == NULL)
/* No /var/nis/NIS_COLD_START->no NIS+ installed. */
return NIS_UNAVAIL;
Expand Down
7 changes: 6 additions & 1 deletion nss/nss_files/files-XXX.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Common code for file-based databases in nss_files module.
Copyright (C) 1996-1999,2001,2002,2004,2007 Free Software Foundation, Inc.
Copyright (C) 1996-1999,2001,2002,2004,2007,2008
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
Expand Down Expand Up @@ -254,8 +255,12 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer,
/* Be prepared that the set*ent function was not called before. */
if (stream == NULL)
{
int save_errno = errno;

status = internal_setent (0);

__set_errno (errno);

if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
{
fclose (stream);
Expand Down

0 comments on commit 0facd3d

Please sign in to comment.