From 1147ac8ad13b104464ff94dbb287a83ddb5066f3 Mon Sep 17 00:00:00 2001 From: drotos Date: Wed, 15 Nov 2006 10:55:39 +0000 Subject: [PATCH] misztikus closedir() hiba misztikus javitasa... git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@961 a7169a2c-3604-0410-bc95-c702d8d87f7a --- dcapi/condor/condor_utils.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dcapi/condor/condor_utils.c b/dcapi/condor/condor_utils.c index 65102985b4..3f16a01a74 100644 --- a/dcapi/condor/condor_utils.c +++ b/dcapi/condor/condor_utils.c @@ -186,7 +186,7 @@ _DC_nuof_messages(char *box, char *name) return(0); if ((d= opendir(box)) == NULL) return(0); - s= malloc(100+name?strlen(name):strlen(_DCAPI_MSG_MESSAGE)); + s= malloc(100 + (name?strlen(name):strlen(_DCAPI_MSG_MESSAGE))); strcpy(s, name?name:_DCAPI_MSG_MESSAGE); strcat(s, "."); while ((de= readdir(d)) != NULL) @@ -195,8 +195,9 @@ _DC_nuof_messages(char *box, char *name) if (found == de->d_name) nuof++; } + if (d) + closedir(d); free(s); - closedir(d); return(nuof); }