From 54ac7d7b30d42956da9aa94d141ce5cb0f0d427f Mon Sep 17 00:00:00 2001 From: Jean-Francois Brousseau Date: Tue, 7 Dec 2004 18:14:05 +0000 Subject: when loading directory info, only close the handle to the Entries file if it is not NULL. fixes a crash when running commands that have no administrative files to open yet (i.e. import) noticed by and discussed with Joris Vink --- usr.bin/cvs/file.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'usr.bin/cvs') diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index fc6974ea9c5..198c13bb1be 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.39 2004/12/07 17:10:56 tedu Exp $ */ +/* $OpenBSD: file.c,v 1.40 2004/12/07 18:14:04 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -615,10 +615,10 @@ cvs_file_getdir(CVSFILE *cf, int flags) } } while (ret > 0); -#if 1 - cvs_ent_close(cdp->cd_ent); - cdp->cd_ent = NULL; -#endif + if (cdp->cd_ent != NULL) { + cvs_ent_close(cdp->cd_ent); + cdp->cd_ent = NULL; + } if (flags & CF_SORT) { cvs_file_sort(&(cdp->cd_files), cdp->cd_nfiles); -- cgit v1.2.3