From f2c8b3648ae5dc8e00d81644e0e628434f00252e Mon Sep 17 00:00:00 2001 From: Jean-Francois Brousseau Date: Sat, 5 Mar 2005 03:00:28 +0000 Subject: make sure that errors from cvs_file_lget() cascade down instead of ignoring them ok joris@ --- usr.bin/cvs/file.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index d7a04eec8e3..ad0bbd30858 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.54 2005/03/02 16:56:58 joris Exp $ */ +/* $OpenBSD: file.c,v 1.55 2005/03/05 03:00:27 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -631,15 +631,18 @@ cvs_file_getdir(CVSFILE *cf, int flags) snprintf(pbuf, sizeof(pbuf), "%s/%s", fpath, ent->d_name); cfp = cvs_file_lget(pbuf, flags, cf); - if (cfp != NULL) { - if (cfp->cf_type == DT_DIR) { - TAILQ_INSERT_TAIL(&dirs, cfp, cf_list); - ndirs++; - } else { - TAILQ_INSERT_TAIL(&(cdp->cd_files), cfp, - cf_list); - cdp->cd_nfiles++; - } + if (cfp == NULL) { + (void)close(fd); + return (-1); + } + + if (cfp->cf_type == DT_DIR) { + TAILQ_INSERT_TAIL(&dirs, cfp, cf_list); + ndirs++; + } else { + TAILQ_INSERT_TAIL(&(cdp->cd_files), cfp, + cf_list); + cdp->cd_nfiles++; } } } while (ret > 0); -- cgit v1.2.3