diff options
Diffstat (limited to 'nis/nis_file.c')
-rw-r--r-- | nis/nis_file.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/nis/nis_file.c b/nis/nis_file.c index 0ffac68fe2..8d652c30e5 100644 --- a/nis/nis_file.c +++ b/nis/nis_file.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (c) 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997. @@ -30,27 +30,31 @@ readColdStartFile (void) { XDR xdrs; FILE *in; - bool_t status; - directory_obj *obj = calloc (1, sizeof (directory_obj)); - - if (obj == NULL) - return NULL; + bool_t status = TRUE; + directory_obj *obj; in = fopen (cold_start_file, "rb"); if (in == NULL) return NULL; - xdrstdio_create (&xdrs, in, XDR_DECODE); - status = _xdr_directory_obj (&xdrs, obj); - xdr_destroy (&xdrs); - fclose (in); - if (status) - return obj; - else + obj = calloc (1, sizeof (directory_obj)); + + if (obj != NULL) { - nis_free_directory (obj); - return NULL; + xdrstdio_create (&xdrs, in, XDR_DECODE); + status = _xdr_directory_obj (&xdrs, obj); + xdr_destroy (&xdrs); + + if (!status) + { + nis_free_directory (obj); + obj = NULL; + } } + + fclose (in); + + return obj; } bool_t |