[PATCH] libkmod-config,depmod: Accept special files as configuration files, too

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we can open it and read it, it's good enough for us. Otherwise, we
cannot use -C /dev/null to skip the system configuration for instance:

$ ./tools/modprobe -C /dev/null -c
libkmod: ERROR libkmod/libkmod-config.c:821 conf_files_list: unsupported
file mode /dev/null: 0x21b6
...
---
 libkmod/libkmod-config.c | 6 +-----
 tools/depmod.c           | 5 +----
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index 32adb8b..4417871 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -813,13 +813,9 @@ static int conf_files_list(struct kmod_ctx *ctx, struct kmod_list **list,
 
 	*path_stamp = stat_mstamp(&st);
 
-	if (S_ISREG(st.st_mode)) {
+	if (!S_ISDIR(st.st_mode)) {
 		conf_files_insert_sorted(ctx, list, path, NULL);
 		return 0;
-	} else if (!S_ISDIR(st.st_mode)) {
-		ERR(ctx, "unsupported file mode %s: %#x\n",
-							path, st.st_mode);
-		return -EINVAL;
 	}
 
 	d = opendir(path);
diff --git a/tools/depmod.c b/tools/depmod.c
index b1b5874..9f83ee8 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -846,12 +846,9 @@ static int cfg_files_list(struct cfg_file ***p_files, size_t *p_n_files,
 		return err;
 	}
 
-	if (S_ISREG(st.st_mode)) {
+	if (!S_ISDIR(st.st_mode)) {
 		cfg_files_insert_sorted(p_files, p_n_files, path, NULL);
 		return 0;
-	} else if (!S_ISDIR(st.st_mode)) {
-		ERR("unsupported file mode %s: %#x\n", path, st.st_mode);
-		return -EINVAL;
 	}
 
 	d = opendir(path);
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux