-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <nss.h>
#include <errno.h>
__libc_lock_define_initialized (static, lock)
-static nis_result *result = NULL;
-static nis_name tablename_val = NULL;
-static u_long tablename_len = 0;
+static nis_result *result;
+static nis_name tablename_val;
+static u_long tablename_len;
#define NISENTRYVAL(idx,col,res) \
((res)->objects.objects_val[(idx)].EN_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val)
{
nis_result *result;
char buf[strlen (name) + 255 + tablename_len];
+ int olderr = errno;
/* Search at first in the alias list, and use the correct name
for the next search */
{
enum nss_status status = niserr2nss (result->status);
+ __set_errno (olderr);
+
nis_freeresult (result);
return status;
}
return NSS_STATUS_TRYAGAIN;
}
else
- return NSS_STATUS_NOTFOUND;
+ {
+ __set_errno (olderr);
+ return NSS_STATUS_NOTFOUND;
+ }
}
return NSS_STATUS_SUCCESS;
}
int parse_res;
nis_result *result;
char buf[46 + tablename_len];
+ int olderr = errno;
sprintf (buf, "[number=%d],%s", number, tablename_val);
{
enum nss_status status = niserr2nss (result->status);
+ __set_errno (olderr);
+
nis_freeresult (result);
return status;
}
return NSS_STATUS_TRYAGAIN;
}
else
- return NSS_STATUS_NOTFOUND;
+ {
+ __set_errno (olderr);
+ return NSS_STATUS_NOTFOUND;
+ }
}
return NSS_STATUS_SUCCESS;
}