aboutsummaryrefslogtreecommitdiff
path: root/modutils/modprobe.c
diff options
context:
space:
mode:
Diffstat (limited to 'modutils/modprobe.c')
-rw-r--r--modutils/modprobe.c31
1 files changed, 1 insertions, 30 deletions
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 {