aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-14 20:03:04 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-14 20:03:04 +0000
commit2416dfc3c9398aaeb37cf31df667784b8f1fe563 (patch)
tree4aead1a4b5264647af00c7dc65ad0af57c35de05
parentdd527d3c6215dba1ad7ddcdd6f393b9fff6dddef (diff)
downloadbusybox-w32-2416dfc3c9398aaeb37cf31df667784b8f1fe563.tar.gz
busybox-w32-2416dfc3c9398aaeb37cf31df667784b8f1fe563.tar.bz2
busybox-w32-2416dfc3c9398aaeb37cf31df667784b8f1fe563.zip
A compromise solution for insmod
-rw-r--r--insmod.c19
-rw-r--r--modutils/insmod.c19
2 files changed, 30 insertions, 8 deletions
diff --git a/insmod.c b/insmod.c
index 44c34a2e8..0644affd1 100644
--- a/insmod.c
+++ b/insmod.c
@@ -124,7 +124,7 @@
124#ifndef MODUTILS_MODULE_H 124#ifndef MODUTILS_MODULE_H
125static const int MODUTILS_MODULE_H = 1; 125static const int MODUTILS_MODULE_H = 1;
126 126
127#ident "$Id: insmod.c,v 1.62 2001/05/14 18:27:25 kraai Exp $" 127#ident "$Id: insmod.c,v 1.63 2001/05/14 20:03:04 andersen Exp $"
128 128
129/* This file contains the structures used by the 2.0 and 2.1 kernels. 129/* This file contains the structures used by the 2.0 and 2.1 kernels.
130 We do not use the kernel headers directly because we do not wish 130 We do not use the kernel headers directly because we do not wish
@@ -330,7 +330,7 @@ int delete_module(const char *);
330#ifndef MODUTILS_OBJ_H 330#ifndef MODUTILS_OBJ_H
331static const int MODUTILS_OBJ_H = 1; 331static const int MODUTILS_OBJ_H = 1;
332 332
333#ident "$Id: insmod.c,v 1.62 2001/05/14 18:27:25 kraai Exp $" 333#ident "$Id: insmod.c,v 1.63 2001/05/14 20:03:04 andersen Exp $"
334 334
335/* The relocatable object is manipulated using elfin types. */ 335/* The relocatable object is manipulated using elfin types. */
336 336
@@ -3180,18 +3180,29 @@ extern int insmod_main( int argc, char **argv)
3180 * but do not error out yet if we fail to find it... */ 3180 * but do not error out yet if we fail to find it... */
3181 if (uname(&myuname) == 0) { 3181 if (uname(&myuname) == 0) {
3182 char module_dir[FILENAME_MAX]; 3182 char module_dir[FILENAME_MAX];
3183 char real_module_dir[FILENAME_MAX];
3183 snprintf (module_dir, sizeof(module_dir), "%s/%s", 3184 snprintf (module_dir, sizeof(module_dir), "%s/%s",
3184 _PATH_MODULES, myuname.release); 3185 _PATH_MODULES, myuname.release);
3185 recursive_action(module_dir, TRUE, TRUE, FALSE, 3186 /* Jump through hoops in case /lib/modules/`uname -r`
3187 * is a symlink. We do not want recursive_action to
3188 * follow symlinks, but we do want to follow the
3189 * /lib/modules/`uname -r` dir, So resolve it ourselves
3190 * if it is a link... */
3191 if (realpath (module_dir, real_module_dir) == NULL)
3192 strcpy(real_module_dir, module_dir);
3193 recursive_action(real_module_dir, TRUE, FALSE, FALSE,
3186 check_module_name_match, 0, m_fullName); 3194 check_module_name_match, 0, m_fullName);
3187 } 3195 }
3188 3196
3189 /* Check if we have found anything yet */ 3197 /* Check if we have found anything yet */
3190 if (m_filename[0] == '\0' || ((fp = fopen(m_filename, "r")) == NULL)) 3198 if (m_filename[0] == '\0' || ((fp = fopen(m_filename, "r")) == NULL))
3191 { 3199 {
3200 char module_dir[FILENAME_MAX];
3201 if (realpath (_PATH_MODULES, module_dir) == NULL)
3202 strcpy(module_dir, _PATH_MODULES);
3192 /* No module found under /lib/modules/`uname -r`, this 3203 /* No module found under /lib/modules/`uname -r`, this
3193 * time cast the net a bit wider. Search /lib/modules/ */ 3204 * time cast the net a bit wider. Search /lib/modules/ */
3194 if (recursive_action(_PATH_MODULES, TRUE, TRUE, FALSE, 3205 if (recursive_action(module_dir, TRUE, FALSE, FALSE,
3195 check_module_name_match, 0, m_fullName) == FALSE) 3206 check_module_name_match, 0, m_fullName) == FALSE)
3196 { 3207 {
3197 if (m_filename[0] == '\0' 3208 if (m_filename[0] == '\0'
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 44c34a2e8..0644affd1 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -124,7 +124,7 @@
124#ifndef MODUTILS_MODULE_H 124#ifndef MODUTILS_MODULE_H
125static const int MODUTILS_MODULE_H = 1; 125static const int MODUTILS_MODULE_H = 1;
126 126
127#ident "$Id: insmod.c,v 1.62 2001/05/14 18:27:25 kraai Exp $" 127#ident "$Id: insmod.c,v 1.63 2001/05/14 20:03:04 andersen Exp $"
128 128
129/* This file contains the structures used by the 2.0 and 2.1 kernels. 129/* This file contains the structures used by the 2.0 and 2.1 kernels.
130 We do not use the kernel headers directly because we do not wish 130 We do not use the kernel headers directly because we do not wish
@@ -330,7 +330,7 @@ int delete_module(const char *);
330#ifndef MODUTILS_OBJ_H 330#ifndef MODUTILS_OBJ_H
331static const int MODUTILS_OBJ_H = 1; 331static const int MODUTILS_OBJ_H = 1;
332 332
333#ident "$Id: insmod.c,v 1.62 2001/05/14 18:27:25 kraai Exp $" 333#ident "$Id: insmod.c,v 1.63 2001/05/14 20:03:04 andersen Exp $"
334 334
335/* The relocatable object is manipulated using elfin types. */ 335/* The relocatable object is manipulated using elfin types. */
336 336
@@ -3180,18 +3180,29 @@ extern int insmod_main( int argc, char **argv)
3180 * but do not error out yet if we fail to find it... */ 3180 * but do not error out yet if we fail to find it... */
3181 if (uname(&myuname) == 0) { 3181 if (uname(&myuname) == 0) {
3182 char module_dir[FILENAME_MAX]; 3182 char module_dir[FILENAME_MAX];
3183 char real_module_dir[FILENAME_MAX];
3183 snprintf (module_dir, sizeof(module_dir), "%s/%s", 3184 snprintf (module_dir, sizeof(module_dir), "%s/%s",
3184 _PATH_MODULES, myuname.release); 3185 _PATH_MODULES, myuname.release);
3185 recursive_action(module_dir, TRUE, TRUE, FALSE, 3186 /* Jump through hoops in case /lib/modules/`uname -r`
3187 * is a symlink. We do not want recursive_action to
3188 * follow symlinks, but we do want to follow the
3189 * /lib/modules/`uname -r` dir, So resolve it ourselves
3190 * if it is a link... */
3191 if (realpath (module_dir, real_module_dir) == NULL)
3192 strcpy(real_module_dir, module_dir);
3193 recursive_action(real_module_dir, TRUE, FALSE, FALSE,
3186 check_module_name_match, 0, m_fullName); 3194 check_module_name_match, 0, m_fullName);
3187 } 3195 }
3188 3196
3189 /* Check if we have found anything yet */ 3197 /* Check if we have found anything yet */
3190 if (m_filename[0] == '\0' || ((fp = fopen(m_filename, "r")) == NULL)) 3198 if (m_filename[0] == '\0' || ((fp = fopen(m_filename, "r")) == NULL))
3191 { 3199 {
3200 char module_dir[FILENAME_MAX];
3201 if (realpath (_PATH_MODULES, module_dir) == NULL)
3202 strcpy(module_dir, _PATH_MODULES);
3192 /* No module found under /lib/modules/`uname -r`, this 3203 /* No module found under /lib/modules/`uname -r`, this
3193 * time cast the net a bit wider. Search /lib/modules/ */ 3204 * time cast the net a bit wider. Search /lib/modules/ */
3194 if (recursive_action(_PATH_MODULES, TRUE, TRUE, FALSE, 3205 if (recursive_action(module_dir, TRUE, FALSE, FALSE,
3195 check_module_name_match, 0, m_fullName) == FALSE) 3206 check_module_name_match, 0, m_fullName) == FALSE)
3196 { 3207 {
3197 if (m_filename[0] == '\0' 3208 if (m_filename[0] == '\0'