diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2009-02-21 12:59:39 -0300 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2009-02-21 12:59:39 -0300 |
commit | 6bc92795d0855cc08cf93e00a13f11595d36c7ec (patch) | |
tree | e9d06bfe56afa6ce0cc056011a657e064a915019 /hardinfo2/arch/linux/common/modules.h | |
parent | bd76c170d0b57077574e2d3f75c5ae029f8a379e (diff) |
Don't rely on hardcoded paths anymore
Diffstat (limited to 'hardinfo2/arch/linux/common/modules.h')
-rw-r--r-- | hardinfo2/arch/linux/common/modules.h | 10 |
1 files changed, 8 insertions, 2 deletions
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); } |