diff options
author | Isaac Dunham <idunham@lavabit.com> | 2013-06-23 14:02:16 -0500 |
---|---|---|
committer | Isaac Dunham <idunham@lavabit.com> | 2013-06-23 14:02:16 -0500 |
commit | 9d5456c70b549e8eded8f634fcdad999b655c205 (patch) | |
tree | 26c23d7c27bdcd45d94b29fbc484d198e7673e90 /toys | |
parent | 1f3c42d490f5e4d354ea4ac22ec16d88ec3b734a (diff) | |
download | toybox-9d5456c70b549e8eded8f634fcdad999b655c205.tar.gz |
Patch that assumes that the presence of the string ".ko" indicates
use of a path to a module (*.ko.xz and similar included, but not supported).
Diffstat (limited to 'toys')
-rw-r--r-- | toys/other/modinfo.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/toys/other/modinfo.c b/toys/other/modinfo.c index 501ba27b..77be2d42 100644 --- a/toys/other/modinfo.c +++ b/toys/other/modinfo.c @@ -38,7 +38,7 @@ static void output_field(char *field, char *value) xputc((toys.optflags & FLAG_0) ? 0 : '\n'); } -static void modinfo_file(struct dirtree *dir) +static int modinfo_file(struct dirtree *dir) { int fd, len, i; char *buf, *pos, *full_name; @@ -49,8 +49,10 @@ static void modinfo_file(struct dirtree *dir) free(full_name); len = fdlength(fd); - if (!(buf = mmap(0, len, PROT_READ, MAP_SHARED, fd, 0))) - perror_exit("mmap %s", full_name); + if (!(buf = mmap(0, len, PROT_READ, MAP_SHARED, fd, 0))) { + perror_msg("mmap %s", full_name); + return 1; + } for (pos = buf; pos < buf+len; pos++) { if (*pos) continue; @@ -66,6 +68,7 @@ static void modinfo_file(struct dirtree *dir) munmap(buf, len); close(fd); + return 0; } static int check_module(struct dirtree *new) @@ -99,6 +102,10 @@ void modinfo_main(void) sprintf(toybuf, "/lib/modules/%s", uts.release); for(TT.mod = 0; TT.mod<toys.optc; TT.mod++) { - dirtree_read(toybuf, check_module); + if (strstr(toys.optargs[TT.mod], ".ko")) { + dirtree_read(toys.optargs[TT.mod], modinfo_file); + } else { + dirtree_read(toybuf, check_module); + } } } |