Library must use O_CLOEXEC whenever it opens file descriptors
diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c
index 5c25266..7f0c092 100644
--- a/libkmod/libkmod-index.c
+++ b/libkmod/libkmod-index.c
@@ -336,7 +336,7 @@
 	uint32_t magic, version;
 	struct index_file *new;
 
-	file = fopen(filename, "r");
+	file = fopen(filename, "re");
 	if (!file)
 		return NULL;
 	errno = EINVAL;
@@ -733,7 +733,7 @@
 		return NULL;
 	}
 
-	if ((fd = open(filename, O_RDONLY)) < 0) {
+	if ((fd = open(filename, O_RDONLY|O_CLOEXEC)) < 0) {
 		ERR(ctx, "%m\n");
 		goto fail_open;
 	}