summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-08-17 18:33:56 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-08-17 18:33:56 +0000
commit43362a244b13e921bfbae71e3c081e79fb00bc01 (patch)
tree77c92092dbb47e6c1565a30a10fbd8d1ebade4f4
parente873d1e448c09a2784816d83d6399147840e0473 (diff)
only close the RCS file if we opened it.
fixes a crash with newly added files. ok jfb@
-rw-r--r--usr.bin/cvs/status.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c
index 8c11a862eab..4194b9718fb 100644
--- a/usr.bin/cvs/status.c
+++ b/usr.bin/cvs/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.45 2005/08/17 08:35:53 xsa Exp $ */
+/* $OpenBSD: status.c,v 1.46 2005/08/17 18:33:55 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
@@ -192,6 +192,7 @@ cvs_status_local(CVSFILE *cf, void *arg)
if (cvs_rcs_getpath(cf, rcspath, sizeof(rcspath)) == NULL)
return (CVS_EX_DATA);
+ rf = NULL;
if (cf->cf_cvstat != CVS_FST_UNKNOWN &&
cf->cf_cvstat != CVS_FST_ADDED) {
rf = rcs_open(rcspath, RCS_READ);
@@ -294,7 +295,9 @@ cvs_status_local(CVSFILE *cf, void *arg)
}
cvs_printf("\n");
- rcs_close(rf);
+
+ if (rf != NULL)
+ rcs_close(rf);
return (0);
}