summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-03-05 03:00:28 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-03-05 03:00:28 +0000
commitf2c8b3648ae5dc8e00d81644e0e628434f00252e (patch)
tree54511a2e7bcb224a75eb9f610baa0ed2a9df1688
parent9a748a73148f4b9b3b7e913ff045ca51655ba078 (diff)
make sure that errors from cvs_file_lget() cascade down instead of
ignoring them ok joris@
-rw-r--r--usr.bin/cvs/file.c23
1 files changed, 13 insertions, 10 deletions
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 <jfb@openbsd.org>
* 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);