summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/modules.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 283d6123a..210579c62 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -201,14 +201,15 @@ int module_already_present(const char * name)
{
FILE * f;
int answ = 0;
- f = fopen("/proc/modules", "rb");
- while (1) {
- char buf[500];
- if (!fgets(buf, sizeof(buf), f)) break;
- if (!strncmp(name, buf, strlen(name)) && buf[strlen(name)] == ' ')
- answ = 1;
- }
- fclose(f);
+ if ((f = fopen("/proc/modules", "rb"))) {
+ while (1) {
+ char buf[500];
+ if (!fgets(buf, sizeof(buf), f)) break;
+ if (!strncmp(name, buf, strlen(name)) && buf[strlen(name)] == ' ')
+ answ = 1;
+ }
+ fclose(f);
+ }
return answ;
}