Prevent fclose(NULL) on SELinux (bb #2200).

This commit is contained in:
Török Edvin
2010-08-13 13:57:53 +03:00
parent 80faa52898
commit a78f2183ed
2 changed files with 9 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
Fri Aug 13 13:57:04 EEST 2010 (edwin)
--------------------------------------
* libclamav/bytecode_detect.c: prevent fclose(NULL) on SELinux (bb #2200)
Thu Aug 12 18:49:37 CEST 2010 (tk)
----------------------------------
* V 0.96.2

View File

@@ -109,9 +109,11 @@ static int detect_SELinux(void)
f = fopen("/selinux/enforce", "r");
if (!f && errno == EACCES)
return 2;
if (fscanf(f, "%d", &enforce) == 1)
if (f) {
if (fscanf(f, "%d", &enforce) == 1)
selinux = 2;
fclose(f);
fclose(f);
}
return selinux;
}
while (fgets(line, sizeof(line), f)) {
@@ -130,8 +132,8 @@ static int detect_SELinux(void)
selinux = 2;
if (enforce == -1)
selinux = 0;
fclose(f);
}
fclose(f);
return selinux;
}