aboutsummaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
Diffstat (limited to 'modutils')
-rw-r--r--modutils/insmod.c4
-rw-r--r--modutils/lsmod.c8
-rw-r--r--modutils/modprobe.c31
3 files changed, 7 insertions, 36 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 3d9add19a..882fcf80f 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -4186,10 +4186,10 @@ int insmod_main( int argc, char **argv)
4186 m_addr = create_module(m_name, m_size); 4186 m_addr = create_module(m_name, m_size);
4187 if (m_addr == -1) switch (errno) { 4187 if (m_addr == -1) switch (errno) {
4188 case EEXIST: 4188 case EEXIST:
4189 bb_error_msg("A module named %s already exists", m_name); 4189 bb_error_msg("a module named %s already exists", m_name);
4190 goto out; 4190 goto out;
4191 case ENOMEM: 4191 case ENOMEM:
4192 bb_error_msg("Can't allocate kernel memory for module; needed %lu bytes", 4192 bb_error_msg("can't allocate kernel memory for module; needed %lu bytes",
4193 m_size); 4193 m_size);
4194 goto out; 4194 goto out;
4195 default: 4195 default:
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index ac1cded2b..2bf4afbe9 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -147,9 +147,8 @@ int lsmod_main(int argc, char **argv)
147 check_tainted(); 147 check_tainted();
148#if defined(CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT) 148#if defined(CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT)
149 { 149 {
150 char line[4096]; 150 char *line;
151 151 while ((line = xmalloc_fgets(file)) != NULL) {
152 while (fgets(line, sizeof(line), file)) {
153 char *tok; 152 char *tok;
154 153
155 tok = strtok(line, " \t"); 154 tok = strtok(line, " \t");
@@ -175,7 +174,8 @@ int lsmod_main(int argc, char **argv)
175 tok = ""; 174 tok = "";
176 printf(" %s", tok); 175 printf(" %s", tok);
177 } 176 }
178 printf("\n"); 177 puts("");
178 free(line);
179 } 179 }
180 fclose(file); 180 fclose(file);
181 } 181 }
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index b629390e4..ab595c847 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -93,35 +93,6 @@ static int parse_tag_value ( char *buffer, char **ptag, char **pvalue )
93 return 1; 93 return 1;
94} 94}
95 95
96/* Jump through hoops to simulate how fgets() grabs just one line at a
97 * time... Don't use any stdio since modprobe gets called from a kernel
98 * thread and stdio junk can overflow the limited stack...
99 */
100static char *reads ( int fd, char *buffer, size_t len )
101{
102 int n = read ( fd, buffer, len );
103
104 if ( n > 0 ) {
105 char *p;
106
107 buffer [len-1] = 0;
108 p = strchr ( buffer, '\n' );
109
110 if ( p ) {
111 off_t offset;
112
113 offset = lseek ( fd, 0L, SEEK_CUR ); // Get the current file descriptor offset
114 lseek ( fd, offset-n + (p-buffer) + 1, SEEK_SET ); // Set the file descriptor offset to right after the \n
115
116 p[1] = 0;
117 }
118 return buffer;
119 }
120
121 else
122 return 0;
123}
124
125/* 96/*
126 * This function appends an option to a list 97 * This function appends an option to a list
127 */ 98 */
@@ -913,7 +884,7 @@ int modprobe_main(int argc, char** argv)
913 depend = build_dep ( ); 884 depend = build_dep ( );
914 885
915 if ( !depend ) 886 if ( !depend )
916 bb_error_msg_and_die ( "could not parse modules.dep" ); 887 bb_error_msg_and_die ( "cannot parse modules.dep" );
917 888
918 if (remove_opt) { 889 if (remove_opt) {
919 do { 890 do {