From 6bc92795d0855cc08cf93e00a13f11595d36c7ec Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Sat, 21 Feb 2009 12:59:39 -0300 Subject: Don't rely on hardcoded paths anymore --- hardinfo2/arch/linux/common/modules.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'hardinfo2/arch/linux/common/modules.h') diff --git a/hardinfo2/arch/linux/common/modules.h b/hardinfo2/arch/linux/common/modules.h index 32c9c0d6..7ea238b7 100644 --- a/hardinfo2/arch/linux/common/modules.h +++ b/hardinfo2/arch/linux/common/modules.h @@ -36,6 +36,7 @@ scan_modules_do(void) { FILE *lsmod; gchar buffer[1024]; + gchar *lsmod_path; if (!_module_hash_table) { _module_hash_table = g_hash_table_new(g_str_hash, g_str_equal); @@ -48,9 +49,12 @@ scan_modules_do(void) module_list = NULL; g_hash_table_foreach_remove(moreinfo, remove_module_devices, NULL); - lsmod = popen("/sbin/lsmod", "r"); - if (!lsmod) + lsmod_path = find_program("lsmod"); + lsmod = popen(lsmod_path, "r"); + if (!lsmod) { + g_free(lsmod_path); return; + } fgets(buffer, 1024, lsmod); /* Discards the first line */ @@ -160,4 +164,6 @@ scan_modules_do(void) g_free(filename); } pclose(lsmod); + + g_free(lsmod_path); } -- cgit v1.2.3