Back to index

glibc  2.9
nis_clone_obj.c File Reference
#include <string.h>
#include <rpc/rpc.h>
#include <rpcsvc/nis.h>
#include "nis_xdr.h"

Go to the source code of this file.


nis_object * nis_clone_object (const nis_object *src, nis_object *dest)

Function Documentation

nis_object* nis_clone_object ( const nis_object *  src,
nis_object *  dest 

Definition at line 27 of file nis_clone_obj.c.

  char *addr;
  unsigned int size;
  XDR xdrs;
  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)
    return NULL;

  if (dest == NULL)
      if ((res = calloc (1, sizeof (nis_object))) == NULL)
       goto out;
    res = dest;

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

  xdr_destroy (&xdrs);
  free (addr);

  return res;

Here is the call graph for this function:

Here is the caller graph for this function: