summaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorRob Landley2006-08-03 17:58:17 +0000
committerRob Landley2006-08-03 17:58:17 +0000
commit86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74 (patch)
treeb3002e01131f99581c1be3462b96b2f2c40408f4 /modutils
parent7478804b783619762a52a740037126ef8711acc2 (diff)
downloadbusybox-86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74.zip
busybox-86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74.tar.gz
These should have been part of 15767 too.
Diffstat (limited to 'modutils')
-rw-r--r--modutils/lsmod.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 1020158..18ee839 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -12,18 +12,18 @@
*/
#include "busybox.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stddef.h>
-#include <errno.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <ctype.h>
-#include <assert.h>
-#include <getopt.h>
-#include <sys/utsname.h>
-#include <sys/file.h>
+//#include <stdlib.h>
+//#include <stdio.h>
+//#include <string.h>
+//#include <stddef.h>
+//#include <errno.h>
+//#include <unistd.h>
+//#include <dirent.h>
+//#include <ctype.h>
+//#include <assert.h>
+//#include <getopt.h>
+//#include <sys/utsname.h>
+//#include <sys/file.h>
#ifndef CONFIG_FEATURE_CHECK_TAINTED_MODULE
@@ -151,15 +151,14 @@ int lsmod_main(int argc, char **argv)
int lsmod_main(int argc, char **argv)
{
+ FILE *file = xfopen("/proc/modules", "r");
+
printf("Module Size Used by");
check_tainted();
#if defined(CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT)
{
- FILE *file;
char line[4096];
- file = bb_xfopen("/proc/modules", "r");
-
while (fgets(line, sizeof(line), file)) {
char *tok;
@@ -190,13 +189,10 @@ int lsmod_main(int argc, char **argv)
}
fclose(file);
}
- return EXIT_SUCCESS;
#else
- if (bb_xprint_file_by_name("/proc/modules") == 0)
- return EXIT_SUCCESS;
+ xprint_and_close_file(file);
#endif /* CONFIG_FEATURE_2_6_MODULES */
-
- return EXIT_FAILURE;
+ return EXIT_SUCCESS;
}
#endif /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */