aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-08-01 18:16:56 +0000
committerMatt Kraai <kraai@debian.org>2000-08-01 18:16:56 +0000
commit0f8f7b8a35cc87965272f53bf9b504866e6e0692 (patch)
tree3c8ee3716604d3a4e86a0fbde01d0caad7b88caf
parent98bbd688a80627ec4071b7c819ee2116f5ecc6d4 (diff)
downloadbusybox-w32-0f8f7b8a35cc87965272f53bf9b504866e6e0692.tar.gz
busybox-w32-0f8f7b8a35cc87965272f53bf9b504866e6e0692.tar.bz2
busybox-w32-0f8f7b8a35cc87965272f53bf9b504866e6e0692.zip
Fix bug 1017, which reports that insmod segfaults when /lib/modules doesn't
exist. Also allow early search termination (per the comments).
-rw-r--r--insmod.c9
-rw-r--r--modutils/insmod.c9
-rw-r--r--utility.c2
3 files changed, 11 insertions, 9 deletions
diff --git a/insmod.c b/insmod.c
index cd75e2416..7b637ef45 100644
--- a/insmod.c
+++ b/insmod.c
@@ -70,7 +70,7 @@
70#ifndef MODUTILS_MODULE_H 70#ifndef MODUTILS_MODULE_H
71#define MODUTILS_MODULE_H 1 71#define MODUTILS_MODULE_H 1
72 72
73#ident "$Id: insmod.c,v 1.19 2000/07/19 17:35:54 andersen Exp $" 73#ident "$Id: insmod.c,v 1.20 2000/08/01 18:16:56 kraai Exp $"
74 74
75/* This file contains the structures used by the 2.0 and 2.1 kernels. 75/* This file contains the structures used by the 2.0 and 2.1 kernels.
76 We do not use the kernel headers directly because we do not wish 76 We do not use the kernel headers directly because we do not wish
@@ -276,7 +276,7 @@ int delete_module(const char *);
276#ifndef MODUTILS_OBJ_H 276#ifndef MODUTILS_OBJ_H
277#define MODUTILS_OBJ_H 1 277#define MODUTILS_OBJ_H 1
278 278
279#ident "$Id: insmod.c,v 1.19 2000/07/19 17:35:54 andersen Exp $" 279#ident "$Id: insmod.c,v 1.20 2000/08/01 18:16:56 kraai Exp $"
280 280
281/* The relocatable object is manipulated using elfin types. */ 281/* The relocatable object is manipulated using elfin types. */
282 282
@@ -2694,7 +2694,7 @@ extern int insmod_main( int argc, char **argv)
2694 if ((fp = fopen(*argv, "r")) == NULL) { 2694 if ((fp = fopen(*argv, "r")) == NULL) {
2695 /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ 2695 /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */
2696 if (recursiveAction(_PATH_MODULES, TRUE, FALSE, FALSE, 2696 if (recursiveAction(_PATH_MODULES, TRUE, FALSE, FALSE,
2697 findNamedModule, 0, m_fullName) == TRUE) 2697 findNamedModule, 0, m_fullName) == FALSE)
2698 { 2698 {
2699 if (m_filename[0] == '\0' 2699 if (m_filename[0] == '\0'
2700 || ((fp = fopen(m_filename, "r")) == NULL)) 2700 || ((fp = fopen(m_filename, "r")) == NULL))
@@ -2702,7 +2702,8 @@ extern int insmod_main( int argc, char **argv)
2702 errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); 2702 errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
2703 exit(FALSE); 2703 exit(FALSE);
2704 } 2704 }
2705 } 2705 } else
2706 fatalError("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
2706 } else 2707 } else
2707 memcpy(m_filename, *argv, strlen(*argv)); 2708 memcpy(m_filename, *argv, strlen(*argv));
2708 2709
diff --git a/modutils/insmod.c b/modutils/insmod.c
index cd75e2416..7b637ef45 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -70,7 +70,7 @@
70#ifndef MODUTILS_MODULE_H 70#ifndef MODUTILS_MODULE_H
71#define MODUTILS_MODULE_H 1 71#define MODUTILS_MODULE_H 1
72 72
73#ident "$Id: insmod.c,v 1.19 2000/07/19 17:35:54 andersen Exp $" 73#ident "$Id: insmod.c,v 1.20 2000/08/01 18:16:56 kraai Exp $"
74 74
75/* This file contains the structures used by the 2.0 and 2.1 kernels. 75/* This file contains the structures used by the 2.0 and 2.1 kernels.
76 We do not use the kernel headers directly because we do not wish 76 We do not use the kernel headers directly because we do not wish
@@ -276,7 +276,7 @@ int delete_module(const char *);
276#ifndef MODUTILS_OBJ_H 276#ifndef MODUTILS_OBJ_H
277#define MODUTILS_OBJ_H 1 277#define MODUTILS_OBJ_H 1
278 278
279#ident "$Id: insmod.c,v 1.19 2000/07/19 17:35:54 andersen Exp $" 279#ident "$Id: insmod.c,v 1.20 2000/08/01 18:16:56 kraai Exp $"
280 280
281/* The relocatable object is manipulated using elfin types. */ 281/* The relocatable object is manipulated using elfin types. */
282 282
@@ -2694,7 +2694,7 @@ extern int insmod_main( int argc, char **argv)
2694 if ((fp = fopen(*argv, "r")) == NULL) { 2694 if ((fp = fopen(*argv, "r")) == NULL) {
2695 /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ 2695 /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */
2696 if (recursiveAction(_PATH_MODULES, TRUE, FALSE, FALSE, 2696 if (recursiveAction(_PATH_MODULES, TRUE, FALSE, FALSE,
2697 findNamedModule, 0, m_fullName) == TRUE) 2697 findNamedModule, 0, m_fullName) == FALSE)
2698 { 2698 {
2699 if (m_filename[0] == '\0' 2699 if (m_filename[0] == '\0'
2700 || ((fp = fopen(m_filename, "r")) == NULL)) 2700 || ((fp = fopen(m_filename, "r")) == NULL))
@@ -2702,7 +2702,8 @@ extern int insmod_main( int argc, char **argv)
2702 errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); 2702 errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
2703 exit(FALSE); 2703 exit(FALSE);
2704 } 2704 }
2705 } 2705 } else
2706 fatalError("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
2706 } else 2707 } else
2707 memcpy(m_filename, *argv, strlen(*argv)); 2708 memcpy(m_filename, *argv, strlen(*argv));
2708 2709
diff --git a/utility.c b/utility.c
index 565fd735c..422d569d2 100644
--- a/utility.c
+++ b/utility.c
@@ -641,7 +641,7 @@ int recursiveAction(const char *fileName,
641 status = 641 status =
642 recursiveAction(nextFile, TRUE, followLinks, depthFirst, 642 recursiveAction(nextFile, TRUE, followLinks, depthFirst,
643 fileAction, dirAction, userData); 643 fileAction, dirAction, userData);
644 if (status < 0) { 644 if (status == FALSE) {
645 closedir(dir); 645 closedir(dir);
646 return FALSE; 646 return FALSE;
647 } 647 }