From 40ec0992d697eeb2cfd708a74c978cadb03deb59 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 29 Mar 2005 11:43:36 +0000 Subject: [PATCH] don't continue if fopen failed --- servers/slapd/back-ldif/ldif.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/servers/slapd/back-ldif/ldif.c b/servers/slapd/back-ldif/ldif.c index 80146064fc..4cca3cd1ab 100644 --- a/servers/slapd/back-ldif/ldif.c +++ b/servers/slapd/back-ldif/ldif.c @@ -224,7 +224,8 @@ static int spew_entry(Entry * e, struct berval * path) { static Entry * get_entry_for_fd(int fd, struct berval *pdn, - struct berval *pndn) { + struct berval *pndn) +{ char * entry = (char *) slurp_file(fd); Entry * ldentry = NULL; @@ -270,7 +271,12 @@ static Entry * get_entry(Operation *op, struct berval *base_path) { if(path.bv_val != NULL) SLAP_FREE(path.bv_val); - return get_entry_for_fd(fd, &pdn, &pndn); + + if ( fd != -1 ) { + return get_entry_for_fd(fd, &pdn, &pndn); + } + + return NULL; } static void fullpath(struct berval *base, struct berval *name, struct berval *res) { -- 2.39.5