diff options
author | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2013-04-17 00:54:17 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2013-04-17 00:57:11 -0300 |
commit | 279b177de62cd9778ed6b111a11d93d8e18fa169 (patch) | |
tree | c0635f1a939ebf54f33c54b4bf684736fb92addb | |
parent | db6f2fc7e1152fb9aee8530e85c40bf514457aa4 (diff) | |
download | kmod-279b177de62cd9778ed6b111a11d93d8e18fa169.tar.gz kmod-279b177de62cd9778ed6b111a11d93d8e18fa169.tar.bz2 kmod-279b177de62cd9778ed6b111a11d93d8e18fa169.zip |
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.
-rw-r--r-- | tools/static-nodes.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/static-nodes.c b/tools/static-nodes.c index 94a48c6..65a36fc 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; } |