diff options
Diffstat (limited to 'modutils')
-rw-r--r-- | modutils/lsmod.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 1020158ed..18ee83929 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c | |||
@@ -12,18 +12,18 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "busybox.h" | 14 | #include "busybox.h" |
15 | #include <stdlib.h> | 15 | //#include <stdlib.h> |
16 | #include <stdio.h> | 16 | //#include <stdio.h> |
17 | #include <string.h> | 17 | //#include <string.h> |
18 | #include <stddef.h> | 18 | //#include <stddef.h> |
19 | #include <errno.h> | 19 | //#include <errno.h> |
20 | #include <unistd.h> | 20 | //#include <unistd.h> |
21 | #include <dirent.h> | 21 | //#include <dirent.h> |
22 | #include <ctype.h> | 22 | //#include <ctype.h> |
23 | #include <assert.h> | 23 | //#include <assert.h> |
24 | #include <getopt.h> | 24 | //#include <getopt.h> |
25 | #include <sys/utsname.h> | 25 | //#include <sys/utsname.h> |
26 | #include <sys/file.h> | 26 | //#include <sys/file.h> |
27 | 27 | ||
28 | 28 | ||
29 | #ifndef CONFIG_FEATURE_CHECK_TAINTED_MODULE | 29 | #ifndef CONFIG_FEATURE_CHECK_TAINTED_MODULE |
@@ -151,15 +151,14 @@ int lsmod_main(int argc, char **argv) | |||
151 | 151 | ||
152 | int lsmod_main(int argc, char **argv) | 152 | int lsmod_main(int argc, char **argv) |
153 | { | 153 | { |
154 | FILE *file = xfopen("/proc/modules", "r"); | ||
155 | |||
154 | printf("Module Size Used by"); | 156 | printf("Module Size Used by"); |
155 | check_tainted(); | 157 | check_tainted(); |
156 | #if defined(CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT) | 158 | #if defined(CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT) |
157 | { | 159 | { |
158 | FILE *file; | ||
159 | char line[4096]; | 160 | char line[4096]; |
160 | 161 | ||
161 | file = bb_xfopen("/proc/modules", "r"); | ||
162 | |||
163 | while (fgets(line, sizeof(line), file)) { | 162 | while (fgets(line, sizeof(line), file)) { |
164 | char *tok; | 163 | char *tok; |
165 | 164 | ||
@@ -190,13 +189,10 @@ int lsmod_main(int argc, char **argv) | |||
190 | } | 189 | } |
191 | fclose(file); | 190 | fclose(file); |
192 | } | 191 | } |
193 | return EXIT_SUCCESS; | ||
194 | #else | 192 | #else |
195 | if (bb_xprint_file_by_name("/proc/modules") == 0) | 193 | xprint_and_close_file(file); |
196 | return EXIT_SUCCESS; | ||
197 | #endif /* CONFIG_FEATURE_2_6_MODULES */ | 194 | #endif /* CONFIG_FEATURE_2_6_MODULES */ |
198 | 195 | return EXIT_SUCCESS; | |
199 | return EXIT_FAILURE; | ||
200 | } | 196 | } |
201 | 197 | ||
202 | #endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ | 198 | #endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ |