summaryrefslogtreecommitdiff
path: root/libc/nis
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-09-12 16:26:54 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2007-09-12 16:26:54 +0000
commit83584a7af898dd93c48600fe850d150c51b10899 (patch)
tree0affa8ffee374ab83e40501d8d8967a03569c44d /libc/nis
parent04b4d23592609edcd19fd5a461bbe6d3cc677b5b (diff)
downloadeglibc2-83584a7af898dd93c48600fe850d150c51b10899.tar.gz
Merge changes between r2424 and r3467 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@3468 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/nis')
-rw-r--r--libc/nis/nis_domain_of.c4
-rw-r--r--libc/nis/nis_subr.c2
-rw-r--r--libc/nis/nis_table.c13
-rw-r--r--libc/nis/nis_xdr.c30
-rw-r--r--libc/nis/nss-default.c5
-rw-r--r--libc/nis/nss_compat/compat-grp.c43
-rw-r--r--libc/nis/nss_compat/compat-initgroups.c42
-rw-r--r--libc/nis/nss_compat/compat-pwd.c43
-rw-r--r--libc/nis/nss_compat/compat-spwd.c43
-rw-r--r--libc/nis/nss_nis/nis-hosts.c2
-rw-r--r--libc/nis/yp_xdr.c10
11 files changed, 181 insertions, 56 deletions
diff --git a/libc/nis/nis_domain_of.c b/libc/nis/nis_domain_of.c
index 4d6b48640..6f41b92bf 100644
--- a/libc/nis/nis_domain_of.c
+++ b/libc/nis/nis_domain_of.c
@@ -32,10 +32,10 @@ __nis_domain_of (const_nis_name name)
{
const_nis_name cptr = strchr (name, '.');
- if (cptr++ == NULL)
+ if (cptr == NULL)
return "";
- if (*cptr == '\0')
+ if (*++cptr == '\0')
return ".";
return cptr;
diff --git a/libc/nis/nis_subr.c b/libc/nis/nis_subr.c
index c68189e54..abe51a999 100644
--- a/libc/nis/nis_subr.c
+++ b/libc/nis/nis_subr.c
@@ -112,7 +112,7 @@ nis_getnames (const_nis_name name)
size_t name_len = strlen (name);
char *path;
int pos = 0;
- char *saveptr;
+ char *saveptr = NULL;
int have_point;
const char *cp;
const char *cp2;
diff --git a/libc/nis/nis_table.c b/libc/nis/nis_table.c
index 70b470141..3704b0094 100644
--- a/libc/nis/nis_table.c
+++ b/libc/nis/nis_table.c
@@ -372,7 +372,8 @@ nis_list (const_nis_name name, unsigned int flags,
&bptr);
if (clnt_status != NIS_SUCCESS)
{
- NIS_RES_STATUS (res) = clnt_status;
+ if (clnt_status == NIS_NOMEMORY)
+ NIS_RES_STATUS (res) = clnt_status;
++done;
}
else
@@ -452,10 +453,14 @@ nis_list (const_nis_name name, unsigned int flags,
++done;
else
{
- NIS_RES_STATUS (res)
+ clnt_status
= __follow_path (&tablepath, &tableptr, ibreq, &bptr);
- if (NIS_RES_STATUS (res) != NIS_SUCCESS)
- ++done;
+ if (clnt_status != NIS_SUCCESS)
+ {
+ if (clnt_status == NIS_NOMEMORY)
+ NIS_RES_STATUS (res) = clnt_status;
+ ++done;
+ }
}
}
break;
diff --git a/libc/nis/nis_xdr.c b/libc/nis/nis_xdr.c
index 0c6452a6a..f2d037aa6 100644
--- a/libc/nis/nis_xdr.c
+++ b/libc/nis/nis_xdr.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@@ -87,7 +87,7 @@ _xdr_nis_server (XDR *xdrs, nis_server *objp)
bool_t res = xdr_nis_name (xdrs, &objp->name);
if (__builtin_expect (res, TRUE))
{
- res = xdr_array (xdrs, (char **) &objp->ep.ep_val, &objp->ep.ep_len,
+ res = xdr_array (xdrs, (void *) &objp->ep.ep_val, &objp->ep.ep_len,
~0, sizeof (endpoint), (xdrproc_t) xdr_endpoint);
if (__builtin_expect (res, TRUE))
{
@@ -108,7 +108,7 @@ _xdr_directory_obj (XDR *xdrs, directory_obj *objp)
res = xdr_nstype (xdrs, &objp->do_type);
if (__builtin_expect (res, TRUE))
{
- res = xdr_array (xdrs, (char **) &objp->do_servers.do_servers_val,
+ res = xdr_array (xdrs, (void *) &objp->do_servers.do_servers_val,
&objp->do_servers.do_servers_len, ~0,
sizeof (nis_server), (xdrproc_t) _xdr_nis_server);
if (__builtin_expect (res, TRUE))
@@ -116,7 +116,7 @@ _xdr_directory_obj (XDR *xdrs, directory_obj *objp)
res = xdr_uint32_t (xdrs, &objp->do_ttl);
if (__builtin_expect (res, TRUE))
res = xdr_array (xdrs,
- (char **) &objp->do_armask.do_armask_val,
+ (void *) &objp->do_armask.do_armask_val,
&objp->do_armask.do_armask_len, ~0,
sizeof (oar_mask), (xdrproc_t) xdr_oar_mask);
}
@@ -140,7 +140,7 @@ xdr_entry_obj (XDR *xdrs, entry_obj *objp)
{
bool_t res = xdr_string (xdrs, &objp->en_type, ~0);
if (__builtin_expect (res, TRUE))
- res = xdr_array (xdrs, (char **) &objp->en_cols.en_cols_val,
+ res = xdr_array (xdrs, (void *) &objp->en_cols.en_cols_val,
&objp->en_cols.en_cols_len, ~0,
sizeof (entry_col), (xdrproc_t) xdr_entry_col);
return res;
@@ -151,7 +151,7 @@ xdr_group_obj (XDR *xdrs, group_obj *objp)
{
bool_t res = xdr_u_int (xdrs, &objp->gr_flags);
if (__builtin_expect (res, TRUE))
- res = xdr_array (xdrs, (char **) &objp->gr_members.gr_members_val,
+ res = xdr_array (xdrs, (void *) &objp->gr_members.gr_members_val,
&objp->gr_members.gr_members_len, ~0,
sizeof (nis_name), (xdrproc_t) _xdr_nis_name);
return res;
@@ -163,7 +163,7 @@ xdr_link_obj (XDR *xdrs, link_obj *objp)
bool_t res = xdr_zotypes (xdrs, &objp->li_rtype);
if (__builtin_expect (res, TRUE))
{
- res = xdr_array (xdrs, (char **) &objp->li_attrs.li_attrs_val,
+ res = xdr_array (xdrs, (void *) &objp->li_attrs.li_attrs_val,
&objp->li_attrs.li_attrs_len, ~0,
sizeof (nis_attr), (xdrproc_t) xdr_nis_attr);
if (__builtin_expect (res, TRUE))
@@ -197,7 +197,7 @@ xdr_table_obj (XDR *xdrs, table_obj *objp)
res = xdr_u_char (xdrs, &objp->ta_sep);
if (__builtin_expect (res, TRUE))
{
- res = xdr_array (xdrs, (char **) &objp->ta_cols.ta_cols_val,
+ res = xdr_array (xdrs, (void *) &objp->ta_cols.ta_cols_val,
&objp->ta_cols.ta_cols_len, ~0,
sizeof (table_col), (xdrproc_t) xdr_table_col);
if (__builtin_expect (res, TRUE))
@@ -296,7 +296,7 @@ _xdr_nis_result (XDR *xdrs, nis_result *objp)
bool_t res = xdr_nis_error (xdrs, &objp->status);
if (__builtin_expect (res, TRUE))
{
- res = xdr_array (xdrs, (char **) &objp->objects.objects_val,
+ res = xdr_array (xdrs, (void *) &objp->objects.objects_val,
&objp->objects.objects_len, ~0,
sizeof (nis_object), (xdrproc_t) _xdr_nis_object);
if (__builtin_expect (res, TRUE))
@@ -327,7 +327,7 @@ _xdr_ns_request (XDR *xdrs, ns_request *objp)
{
bool_t res = xdr_nis_name (xdrs, &objp->ns_name);
if (__builtin_expect (res, TRUE))
- res = xdr_array (xdrs, (char **) &objp->ns_object.ns_object_val,
+ res = xdr_array (xdrs, (void *) &objp->ns_object.ns_object_val,
&objp->ns_object.ns_object_len, 1,
sizeof (nis_object), (xdrproc_t) _xdr_nis_object);
return res;
@@ -339,7 +339,7 @@ _xdr_ib_request (XDR *xdrs, ib_request *objp)
bool_t res = xdr_nis_name (xdrs, &objp->ibr_name);
if (__builtin_expect (res, TRUE))
{
- res = xdr_array (xdrs, (char **) &objp->ibr_srch.ibr_srch_val,
+ res = xdr_array (xdrs, (void *) &objp->ibr_srch.ibr_srch_val,
&objp->ibr_srch.ibr_srch_len, ~0,
sizeof (nis_attr), (xdrproc_t) xdr_nis_attr);
if (__builtin_expect (res, TRUE))
@@ -347,14 +347,14 @@ _xdr_ib_request (XDR *xdrs, ib_request *objp)
res = xdr_u_int (xdrs, &objp->ibr_flags);
if (__builtin_expect (res, TRUE))
{
- res = xdr_array (xdrs, (char **) &objp->ibr_obj.ibr_obj_val,
+ res = xdr_array (xdrs, (void *) &objp->ibr_obj.ibr_obj_val,
&objp->ibr_obj.ibr_obj_len, 1,
sizeof (nis_object),
(xdrproc_t) _xdr_nis_object);
if (__builtin_expect (res, TRUE))
{
res = xdr_array (xdrs,
- (char **) &objp->ibr_cbhost.ibr_cbhost_val,
+ (void *) &objp->ibr_cbhost.ibr_cbhost_val,
&objp->ibr_cbhost.ibr_cbhost_len, 1,
sizeof (nis_server),
(xdrproc_t) _xdr_nis_server);
@@ -406,7 +406,7 @@ _xdr_nis_tag (XDR *xdrs, nis_tag *objp)
bool_t
_xdr_nis_taglist (XDR *xdrs, nis_taglist *objp)
{
- return xdr_array (xdrs, (char **) &objp->tags.tags_val,
+ return xdr_array (xdrs, (void *) &objp->tags.tags_val,
&objp->tags.tags_len, ~0, sizeof (nis_tag),
(xdrproc_t) _xdr_nis_tag);
}
@@ -452,7 +452,7 @@ libnsl_hidden_def (xdr_obj_p)
bool_t
xdr_cback_data (XDR *xdrs, cback_data *objp)
{
- return xdr_array (xdrs, (char **)&objp->entries.entries_val,
+ return xdr_array (xdrs, (void *) &objp->entries.entries_val,
&objp->entries.entries_len, ~0,
sizeof (obj_p), (xdrproc_t) xdr_obj_p);
}
diff --git a/libc/nis/nss-default.c b/libc/nis/nss-default.c
index 577f7c2d4..046ddfee8 100644
--- a/libc/nis/nss-default.c
+++ b/libc/nis/nss-default.c
@@ -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);
}
diff --git a/libc/nis/nss_compat/compat-grp.c b/libc/nis/nss_compat/compat-grp.c
index 236c84a20..939102868 100644
--- a/libc/nis/nss_compat/compat-grp.c
+++ b/libc/nis/nss_compat/compat-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -27,6 +27,7 @@
#include <string.h>
#include <rpc/types.h>
#include <bits/libc-lock.h>
+#include <kernel-features.h>
static service_user *ni;
static enum nss_status (*nss_setgrent) (int stayopen);
@@ -70,6 +71,19 @@ static ent_t ext_ent = { TRUE, NSS_STATUS_SUCCESS, NULL, { NULL, 0, 0 }};
/* Protect global state against multiple changers. */
__libc_lock_define_initialized (static, lock)
+/* Positive if O_CLOEXEC is supported, negative if it is not supported,
+ zero if it is still undecided. This variable is shared with the
+ other compat functions. */
+#ifdef __ASSUME_O_CLOEXEC
+# define __compat_have_cloexec 1
+#else
+# ifdef O_CLOEXEC
+int __compat_have_cloexec;
+# else
+# define __compat_have_cloexec -1
+# endif
+#endif
+
/* Prototypes for local functions. */
static void blacklist_store_name (const char *, ent_t *);
static int in_blacklist (const char *, int, ent_t *);
@@ -107,21 +121,36 @@ internal_setgrent (ent_t *ent, int stayopen, int needent)
if (ent->stream == NULL)
{
- ent->stream = fopen ("/etc/group", "rm");
+ ent->stream = fopen ("/etc/group", "rme");
if (ent->stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
else
{
/* We have to make sure the file is `closed on exec'. */
- int result, flags;
+ int result = 0;
- result = flags = fcntl (fileno_unlocked (ent->stream), F_GETFD, 0);
- if (result >= 0)
+ if (__compat_have_cloexec <= 0)
{
- flags |= FD_CLOEXEC;
- result = fcntl (fileno_unlocked (ent->stream), F_SETFD, flags);
+ int flags;
+ result = flags = fcntl (fileno_unlocked (ent->stream), F_GETFD,
+ 0);
+ if (result >= 0)
+ {
+#if defined O_CLOEXEC && !defined __ASSUME_O_CLOEXEC
+ if (__compat_have_cloexec == 0)
+ __compat_have_cloexec = (flags & FD_CLOEXEC) ? 1 : -1;
+
+ if (__compat_have_cloexec < 0)
+#endif
+ {
+ flags |= FD_CLOEXEC;
+ result = fcntl (fileno_unlocked (ent->stream), F_SETFD,
+ flags);
+ }
+ }
}
+
if (result < 0)
{
/* Something went wrong. Close the stream and return a
diff --git a/libc/nis/nss_compat/compat-initgroups.c b/libc/nis/nss_compat/compat-initgroups.c
index 70403a078..fd16475ea 100644
--- a/libc/nis/nss_compat/compat-initgroups.c
+++ b/libc/nis/nss_compat/compat-initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2003, 2004, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2004, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
@@ -30,6 +30,7 @@
#include <sys/param.h>
#include <nsswitch.h>
#include <bits/libc-lock.h>
+#include <kernel-features.h>
static service_user *ni;
/* Type of the lookup function. */
@@ -74,6 +75,19 @@ struct ent_t
typedef struct ent_t ent_t;
+/* Positive if O_CLOEXEC is supported, negative if it is not supported,
+ zero if it is still undecided. This variable is shared with the
+ other compat functions. */
+#ifdef __ASSUME_O_CLOEXEC
+# define __compat_have_cloexec 1
+#else
+# ifdef O_CLOEXEC
+extern int __compat_have_cloexec;
+# else
+# define __compat_have_cloexec -1
+# endif
+#endif
+
/* Prototypes for local functions. */
static void blacklist_store_name (const char *, ent_t *);
static int in_blacklist (const char *, int, ent_t *);
@@ -117,21 +131,35 @@ internal_setgrent (ent_t *ent)
else
ent->blacklist.current = 0;
- ent->stream = fopen ("/etc/group", "rm");
+ ent->stream = fopen ("/etc/group", "rme");
if (ent->stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
else
{
/* We have to make sure the file is `closed on exec'. */
- int result, flags;
+ int result = 0;
- result = flags = fcntl (fileno_unlocked (ent->stream), F_GETFD, 0);
- if (result >= 0)
+ if (__compat_have_cloexec <= 0)
{
- flags |= FD_CLOEXEC;
- result = fcntl (fileno_unlocked (ent->stream), F_SETFD, flags);
+ int flags;
+ result = flags = fcntl (fileno_unlocked (ent->stream), F_GETFD, 0);
+ if (result >= 0)
+ {
+#if defined O_CLOEXEC && !defined __ASSUME_O_CLOEXEC
+ if (__compat_have_cloexec == 0)
+ __compat_have_cloexec = (flags & FD_CLOEXEC) ? 1 : -1;
+
+ if (__compat_have_cloexec < 0)
+#endif
+ {
+ flags |= FD_CLOEXEC;
+ result = fcntl (fileno_unlocked (ent->stream), F_SETFD,
+ flags);
+ }
+ }
}
+
if (result < 0)
{
/* Something went wrong. Close the stream and return a
diff --git a/libc/nis/nss_compat/compat-pwd.c b/libc/nis/nss_compat/compat-pwd.c
index ac132046d..df8f91eea 100644
--- a/libc/nis/nss_compat/compat-pwd.c
+++ b/libc/nis/nss_compat/compat-pwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@@ -29,6 +29,7 @@
#include <rpc/types.h>
#include <rpcsvc/ypclnt.h>
#include <bits/libc-lock.h>
+#include <kernel-features.h>
#include "netgroup.h"
@@ -80,6 +81,19 @@ static ent_t ext_ent = { false, false, true, NSS_STATUS_SUCCESS, NULL,
/* Protect global state against multiple changers. */
__libc_lock_define_initialized (static, lock)
+/* Positive if O_CLOEXEC is supported, negative if it is not supported,
+ zero if it is still undecided. This variable is shared with the
+ other compat functions. */
+#ifdef __ASSUME_O_CLOEXEC
+# define __compat_have_cloexec 1
+#else
+# ifdef O_CLOEXEC
+extern int __compat_have_cloexec;
+# else
+# define __compat_have_cloexec -1
+# endif
+#endif
+
/* Prototypes for local functions. */
static void blacklist_store_name (const char *, ent_t *);
static int in_blacklist (const char *, int, ent_t *);
@@ -227,21 +241,36 @@ internal_setpwent (ent_t *ent, int stayopen, int needent)
if (ent->stream == NULL)
{
- ent->stream = fopen ("/etc/passwd", "rm");
+ ent->stream = fopen ("/etc/passwd", "rme");
if (ent->stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
else
{
/* We have to make sure the file is `closed on exec'. */
- int result, flags;
+ int result = 0;
- result = flags = fcntl (fileno_unlocked (ent->stream), F_GETFD, 0);
- if (result >= 0)
+ if (__compat_have_cloexec <= 0)
{
- flags |= FD_CLOEXEC;
- result = fcntl (fileno_unlocked (ent->stream), F_SETFD, flags);
+ int flags;
+ result = flags = fcntl (fileno_unlocked (ent->stream), F_GETFD,
+ 0);
+ if (result >= 0)
+ {
+#if defined O_CLOEXEC && !defined __ASSUME_O_CLOEXEC
+ if (__compat_have_cloexec == 0)
+ __compat_have_cloexec = (flags & FD_CLOEXEC) ? 1 : -1;
+
+ if (__compat_have_cloexec < 0)
+#endif
+ {
+ flags |= FD_CLOEXEC;
+ result = fcntl (fileno_unlocked (ent->stream), F_SETFD,
+ flags);
+ }
+ }
}
+
if (result < 0)
{
/* Something went wrong. Close the stream and return a
diff --git a/libc/nis/nss_compat/compat-spwd.c b/libc/nis/nss_compat/compat-spwd.c
index d1de3f75b..a5977681f 100644
--- a/libc/nis/nss_compat/compat-spwd.c
+++ b/libc/nis/nss_compat/compat-spwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2005,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1996-1999, 2001-2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
@@ -29,6 +29,7 @@
#include <rpc/types.h>
#include <rpcsvc/ypclnt.h>
#include <bits/libc-lock.h>
+#include <kernel-features.h>
#include "netgroup.h"
@@ -77,6 +78,19 @@ static ent_t ext_ent = { false, true, false, NSS_STATUS_SUCCESS, NULL,
/* Protect global state against multiple changers. */
__libc_lock_define_initialized (static, lock)
+/* Positive if O_CLOEXEC is supported, negative if it is not supported,
+ zero if it is still undecided. This variable is shared with the
+ other compat functions. */
+#ifdef __ASSUME_O_CLOEXEC
+# define __compat_have_cloexec 1
+#else
+# ifdef O_CLOEXEC
+extern int __compat_have_cloexec;
+# else
+# define __compat_have_cloexec -1
+# endif
+#endif
+
/* Prototypes for local functions. */
static void blacklist_store_name (const char *, ent_t *);
static int in_blacklist (const char *, int, ent_t *);
@@ -180,21 +194,36 @@ internal_setspent (ent_t *ent, int stayopen)
if (ent->stream == NULL)
{
- ent->stream = fopen ("/etc/shadow", "rm");
+ ent->stream = fopen ("/etc/shadow", "rme");
if (ent->stream == NULL)
status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
else
{
/* We have to make sure the file is `closed on exec'. */
- int result, flags;
+ int result = 0;
- result = flags = fcntl (fileno_unlocked (ent->stream), F_GETFD, 0);
- if (result >= 0)
+ if (__compat_have_cloexec <= 0)
{
- flags |= FD_CLOEXEC;
- result = fcntl (fileno_unlocked (ent->stream), F_SETFD, flags);
+ int flags;
+ result = flags = fcntl (fileno_unlocked (ent->stream), F_GETFD,
+ 0);
+ if (result >= 0)
+ {
+#if defined O_CLOEXEC && !defined __ASSUME_O_CLOEXEC
+ if (__compat_have_cloexec == 0)
+ __compat_have_cloexec = (flags & FD_CLOEXEC) ? 1 : -1;
+
+ if (__compat_have_cloexec < 0)
+#endif
+ {
+ flags |= FD_CLOEXEC;
+ result = fcntl (fileno_unlocked (ent->stream), F_SETFD,
+ flags);
+ }
+ }
}
+
if (result < 0)
{
/* Something went wrong. Close the stream and return a
diff --git a/libc/nis/nss_nis/nis-hosts.c b/libc/nis/nss_nis/nis-hosts.c
index bde0a3291..7bf4af786 100644
--- a/libc/nis/nss_nis/nis-hosts.c
+++ b/libc/nis/nss_nis/nis-hosts.c
@@ -88,7 +88,7 @@ LINE_PARSER
return 0;
/* Store a pointer to the address in the expected form. */
- entdata->h_addr_ptrs[0] = entdata->host_addr;
+ entdata->h_addr_ptrs[0] = (char *) entdata->host_addr;
entdata->h_addr_ptrs[1] = NULL;
result->h_addr_list = entdata->h_addr_ptrs;
diff --git a/libc/nis/yp_xdr.c b/libc/nis/yp_xdr.c
index b87ee0615..bdd5d8725 100644
--- a/libc/nis/yp_xdr.c
+++ b/libc/nis/yp_xdr.c
@@ -195,8 +195,9 @@ xdr_ypmaplist (XDR *xdrs, ypmaplist *objp)
{
if (!xdr_mapname (xdrs, &objp->map))
return FALSE;
- return xdr_pointer (xdrs, (char **) &objp->next, sizeof (ypmaplist),
- (xdrproc_t) xdr_ypmaplist);
+ /* Prevent gcc warning about alias violation. */
+ char **tp = (void *) &objp->next;
+ return xdr_pointer (xdrs, tp, sizeof (ypmaplist), (xdrproc_t) xdr_ypmaplist);
}
libnsl_hidden_def (xdr_ypmaplist)
@@ -205,8 +206,9 @@ xdr_ypresp_maplist (XDR *xdrs, ypresp_maplist *objp)
{
if (!xdr_ypstat (xdrs, &objp->stat))
return FALSE;
- return xdr_pointer (xdrs, (char **) &objp->maps, sizeof (ypmaplist),
- (xdrproc_t) xdr_ypmaplist);
+ /* Prevent gcc warning about alias violation. */
+ char **tp = (void *) &objp->maps;
+ return xdr_pointer (xdrs, tp, sizeof (ypmaplist), (xdrproc_t) xdr_ypmaplist);
}
libnsl_hidden_def (xdr_ypresp_maplist)