Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
	* include/libc-symbols.h: Define hidden attribute macros for libnsl.
	* include/rpcsvc/nislib.h: Use libnsl_hidden_proto for various
	functions.
	* nis/nis_add.c: Add libnsl_hidden_def.  Minor optimizations.
	* nis/nis_call.c: Likewise.
	* nis/nis_clone_obj.c: Likewise.
	* nis/nis_defaults.c: Likewise.
	* nis/nis_domain_of_r.c: Likewise.
	* nis/nis_error.c: Likewise.
	* nis/nis_file.c: Likewise.
	* nis/nis_free.c: Likewise.
	* nis/nis_local_names.c: Likewise.
	* nis/nis_lookup.c: Likewise.
	* nis/nis_modify.c: Likewise.
	* nis/nis_print.c: Likewise.
	* nis/nis_remove.c: Likewise.
	* nis/nis_subr.c: Likewise.
	* nis/nis_table.c: Likewise.
	* nis/nis_util.c: Likewise.
	* nis/yp_xdr.c: Likewise.
	* nis/ypclnt.c: Likewise.
	* nis/ypupdate_xdr.c: Likewise.
  • Loading branch information
Ulrich Drepper committed Oct 24, 2004
1 parent 1d5cee2 commit 7440c23
Show file tree
Hide file tree
Showing 21 changed files with 233 additions and 191 deletions.
23 changes: 23 additions & 0 deletions ChangeLog
@@ -1,5 +1,28 @@
2004-10-24 Ulrich Drepper <drepper@redhat.com>

* include/libc-symbols.h: Define hidden attribute macros for libnsl.
* include/rpcsvc/nislib.h: Use libnsl_hidden_proto for various
functions.
* nis/nis_add.c: Add libnsl_hidden_def. Minor optimizations.
* nis/nis_call.c: Likewise.
* nis/nis_clone_obj.c: Likewise.
* nis/nis_defaults.c: Likewise.
* nis/nis_domain_of_r.c: Likewise.
* nis/nis_error.c: Likewise.
* nis/nis_file.c: Likewise.
* nis/nis_free.c: Likewise.
* nis/nis_local_names.c: Likewise.
* nis/nis_lookup.c: Likewise.
* nis/nis_modify.c: Likewise.
* nis/nis_print.c: Likewise.
* nis/nis_remove.c: Likewise.
* nis/nis_subr.c: Likewise.
* nis/nis_table.c: Likewise.
* nis/nis_util.c: Likewise.
* nis/yp_xdr.c: Likewise.
* nis/ypclnt.c: Likewise.
* nis/ypupdate_xdr.c: Likewise.

* resolv/res_send.c (send_dg): Cope with failures.

* include/libc-symbols.h: Define hidden attribute macros for
Expand Down
44 changes: 44 additions & 0 deletions include/rpcsvc/nislib.h
@@ -1 +1,45 @@
#ifndef __RPCSVC_NISLIB_H__
#include <nis/rpcsvc/nislib.h>

libnsl_hidden_proto (nis_leaf_of_r)
libnsl_hidden_proto (nis_name_of_r)
libnsl_hidden_proto (nis_getnames)
libnsl_hidden_proto (nis_freenames)
libnsl_hidden_proto (nis_dir_cmp)
libnsl_hidden_proto (nis_destroy_object)
libnsl_hidden_proto (nis_local_directory)
libnsl_hidden_proto (nis_local_group)
libnsl_hidden_proto (nis_local_host)
libnsl_hidden_proto (nis_local_principal)
libnsl_hidden_proto (__free_fdresult)
libnsl_hidden_proto (nis_free_request)
libnsl_hidden_proto (nis_free_directory)
libnsl_hidden_proto (nis_free_object)
libnsl_hidden_proto (nis_freeresult)
libnsl_hidden_proto (readColdStartFile)
libnsl_hidden_proto (nis_print_rights)
libnsl_hidden_proto (nis_print_directory)
libnsl_hidden_proto (nis_print_group)
libnsl_hidden_proto (nis_print_table)
libnsl_hidden_proto (nis_print_link)
libnsl_hidden_proto (nis_print_entry)
libnsl_hidden_proto (nis_print_object)
libnsl_hidden_proto (nis_sperrno)
libnsl_hidden_proto (nis_sperror_r)
libnsl_hidden_proto (__nisbind_destroy)
libnsl_hidden_proto (__nisbind_next)
libnsl_hidden_proto (__nisbind_connect)
libnsl_hidden_proto (__nisbind_create)
libnsl_hidden_proto (nis_lookup)
libnsl_hidden_proto (nis_list)
libnsl_hidden_proto (__nis_finddirectory)
libnsl_hidden_proto (nis_domain_of_r)
libnsl_hidden_proto (nis_modify)
libnsl_hidden_proto (nis_remove)
libnsl_hidden_proto (nis_add)
libnsl_hidden_proto (__nis_default_owner)
libnsl_hidden_proto (__nis_default_group)
libnsl_hidden_proto (__nis_default_access)
libnsl_hidden_proto (nis_clone_object)

#endif
3 changes: 2 additions & 1 deletion nis/nis_add.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
/* Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
Expand Down Expand Up @@ -72,3 +72,4 @@ nis_add (const_nis_name name, const nis_object *obj2)

return res;
}
libnsl_hidden_def (nis_add)
6 changes: 5 additions & 1 deletion nis/nis_call.c
@@ -1,4 +1,4 @@
/* Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc.
/* Copyright (C) 1997, 1998, 2001, 2004 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 @@ -71,6 +71,7 @@ __nisbind_destroy (dir_binding *bind)
clnt_destroy (bind->clnt);
}
}
libnsl_hidden_def (__nisbind_destroy)

nis_error
__nisbind_next (dir_binding *bind)
Expand Down Expand Up @@ -114,6 +115,7 @@ __nisbind_next (dir_binding *bind)

return NIS_FAIL;
}
libnsl_hidden_def (__nisbind_next)

nis_error
__nisbind_connect (dir_binding *dbp)
Expand Down Expand Up @@ -179,6 +181,7 @@ __nisbind_connect (dir_binding *dbp)

return NIS_SUCCESS;
}
libnsl_hidden_def (__nisbind_connect)

nis_error
__nisbind_create (dir_binding *dbp, const nis_server *serv_val,
Expand Down Expand Up @@ -216,6 +219,7 @@ __nisbind_create (dir_binding *dbp, const nis_server *serv_val,

return NIS_SUCCESS;
}
libnsl_hidden_def (__nisbind_create)

/* __nisbind_connect (dbp) must be run before calling this function !
So we could use the same binding twice */
Expand Down
36 changes: 17 additions & 19 deletions nis/nis_clone_obj.c
@@ -1,4 +1,4 @@
/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
/* Copyright (c) 1997, 1998, 2004 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 @@ -29,43 +29,41 @@ nis_clone_object (const nis_object *src, nis_object *dest)
unsigned char *addr;
unsigned long size;
XDR xdrs;
nis_object *res;
nis_object *res = NULL;

if (src == NULL)
return (NULL);

size = xdr_sizeof ((xdrproc_t)_xdr_nis_object, (char *)src);
if ((addr = calloc(1, size)) == NULL)
size = xdr_sizeof ((xdrproc_t)_xdr_nis_object, (char *) src);
if ((addr = calloc (1, size)) == NULL)
return NULL;

if (dest == NULL)
{
if ((res = calloc (1, sizeof (nis_object))) == NULL)
{
free (addr);
return NULL;
}
goto out2;
}
else
res = dest;

xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
xdrmem_create (&xdrs, addr, size, XDR_ENCODE);
if (!_xdr_nis_object (&xdrs, (nis_object *)src))
{
xdr_destroy (&xdrs);
free (addr);
return NULL;
}
goto out3;
xdr_destroy (&xdrs);
xdrmem_create(&xdrs, addr, size, XDR_DECODE);
if (!_xdr_nis_object(&xdrs, res))
xdrmem_create (&xdrs, addr, size, XDR_DECODE);
if (!_xdr_nis_object (&xdrs, res))
{
xdr_destroy (&xdrs);
free (addr);
return NULL;
out3:
if (dest == NULL)
free (res);
res = NULL;
}

out:
xdr_destroy (&xdrs);
out2:
free (addr);

return res;
}
libnsl_hidden_def (nis_clone_object)
5 changes: 4 additions & 1 deletion nis/nis_defaults.c
@@ -1,4 +1,4 @@
/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
/* Copyright (c) 1997, 1998, 2004 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 @@ -395,6 +395,7 @@ __nis_default_owner (char *defaults)

return strdup (default_owner);
}
libnsl_hidden_def (__nis_default_owner)

nis_name
__nis_default_group (char *defaults)
Expand Down Expand Up @@ -435,6 +436,7 @@ __nis_default_group (char *defaults)

return strdup (default_group);
}
libnsl_hidden_def (__nis_default_group)

uint32_t
__nis_default_ttl (char *defaults)
Expand Down Expand Up @@ -483,3 +485,4 @@ __nis_default_access (char *param, unsigned int defaults)

return result;
}
libnsl_hidden_def (__nis_default_access)
16 changes: 8 additions & 8 deletions nis/nis_domain_of_r.c
@@ -1,4 +1,4 @@
/* Copyright (c) 1997 Free Software Foundation, Inc.
/* Copyright (c) 1997, 2004 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 @@ -29,7 +29,7 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)

if (buffer == NULL)
{
errno = ERANGE;
__set_errno (ERANGE);
return NULL;
}

Expand All @@ -44,14 +44,14 @@ nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
cptr_len = strlen (cptr);

if (cptr_len == 0)
strcpy (buffer, ".");
else if (cptr_len >= buflen)
return strcpy (buffer, ".");

if (__builtin_expect (cptr_len >= buflen, 0))
{
errno = ERANGE;
__set_errno (ERANGE);
return NULL;
}
else
memcpy (buffer, cptr, cptr_len + 1);

return buffer;
return memcpy (buffer, cptr, cptr_len + 1);
}
libnsl_hidden_proto (nis_domain_of_r)
4 changes: 3 additions & 1 deletion nis/nis_error.c
@@ -1,4 +1,4 @@
/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
/* Copyright (c) 1997, 1998, 1999, 2004 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 @@ -84,6 +84,7 @@ nis_sperrno (const nis_error status)
else
return gettext (nis_errlist[status]);
}
libnsl_hidden_def (nis_sperrno)

void
nis_perror (const nis_error status, const char *label)
Expand Down Expand Up @@ -115,6 +116,7 @@ nis_sperror_r (const nis_error status, const char *label,

return buffer;
}
libnsl_hidden_def (nis_sperror_r)

char *
nis_sperror (const nis_error status, const char *label)
Expand Down
15 changes: 6 additions & 9 deletions nis/nis_file.c
@@ -1,4 +1,4 @@
/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc.
/* Copyright (c) 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1997.
Expand Down Expand Up @@ -28,21 +28,17 @@ static const char cold_start_file[] = "/var/nis/NIS_COLD_START";
directory_obj *
readColdStartFile (void)
{
XDR xdrs;
FILE *in;
bool_t status = TRUE;
directory_obj *obj;

in = fopen (cold_start_file, "rb");
FILE *in = fopen (cold_start_file, "rc");
if (in == NULL)
return NULL;

obj = calloc (1, sizeof (directory_obj));
directory_obj *obj = calloc (1, sizeof (directory_obj));

if (obj != NULL)
{
XDR xdrs;
xdrstdio_create (&xdrs, in, XDR_DECODE);
status = _xdr_directory_obj (&xdrs, obj);
bool_t status = _xdr_directory_obj (&xdrs, obj);
xdr_destroy (&xdrs);

if (!status)
Expand All @@ -56,6 +52,7 @@ readColdStartFile (void)

return obj;
}
libnsl_hidden_def (readColdStartFile)

bool_t
writeColdStartFile (const directory_obj *obj)
Expand Down
7 changes: 6 additions & 1 deletion nis/nis_free.c
@@ -1,4 +1,4 @@
/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
/* Copyright (c) 1997, 1998, 2004 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 @@ -29,6 +29,7 @@ __free_fdresult (fd_result *res)
free (res);
}
}
libnsl_hidden_def (__free_fdresult)

void
nis_free_request (ib_request *ibreq)
Expand All @@ -39,6 +40,7 @@ nis_free_request (ib_request *ibreq)
free (ibreq);
}
}
libnsl_hidden_def (nis_free_request)

void
nis_free_directory (directory_obj *obj)
Expand All @@ -49,6 +51,7 @@ nis_free_directory (directory_obj *obj)
free (obj);
}
}
libnsl_hidden_def (nis_free_directory)

void
nis_free_object (nis_object *obj)
Expand All @@ -59,6 +62,7 @@ nis_free_object (nis_object *obj)
free (obj);
}
}
libnsl_hidden_def (nis_free_object)

void
nis_freeresult (nis_result *res)
Expand All @@ -69,3 +73,4 @@ nis_freeresult (nis_result *res)
free (res);
}
}
libnsl_hidden_def (nis_freeresult)

0 comments on commit 7440c23

Please sign in to comment.