From: Lucas De Marchi Date: Wed, 17 Apr 2013 03:54:17 +0000 (-0300) Subject: kmod: It's an error not to have modules.devname X-Git-Tag: v14~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=279b177de62cd9778ed6b111a11d93d8e18fa169;p=thirdparty%2Fkmod.git kmod: It's an error not to have modules.devname This file is created by depmod even if there's no node. In this case it will be empty. Previously 'kmod static-nodes' was segfaulting due to passing in==NULL to fgets. Also show the error message with %m. --- diff --git a/tools/static-nodes.c b/tools/static-nodes.c index 94a48c66..65a36fc0 100644 --- a/tools/static-nodes.c +++ b/tools/static-nodes.c @@ -203,10 +203,11 @@ static int do_static_nodes(int argc, char *argv[]) ret = EXIT_FAILURE; goto finish; } + snprintf(modules, sizeof(modules), "/lib/modules/%s/modules.devname", kernel.release); in = fopen(modules, "re"); - if (in == NULL && errno != ENOENT) { - fprintf(stderr, "Error: could not open /lib/modules/%s/modules.devname!\n", kernel.release); + if (in == NULL) { + fprintf(stderr, "Error: could not open /lib/modules/%s/modules.devname - %m\n", kernel.release); ret = EXIT_FAILURE; goto finish; }