diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-01-25 04:11:06 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-01-25 04:11:06 +0000 |
commit | 155c89b0c3aa0e86c630bccc0af4143223b49121 (patch) | |
tree | 86a71a2956eb83164a6c98743d75938ee596e38a | |
parent | 15f29e7d86f5196955b8e1e4a2fa50856a137530 (diff) | |
download | busybox-w32-155c89b0c3aa0e86c630bccc0af4143223b49121.tar.gz busybox-w32-155c89b0c3aa0e86c630bccc0af4143223b49121.tar.bz2 busybox-w32-155c89b0c3aa0e86c630bccc0af4143223b49121.zip |
I just wrote 'insmod -o' to close bug#1049.
-rw-r--r-- | insmod.c | 15 | ||||
-rw-r--r-- | modutils/insmod.c | 15 |
2 files changed, 20 insertions, 10 deletions
@@ -78,7 +78,7 @@ | |||
78 | #ifndef MODUTILS_MODULE_H | 78 | #ifndef MODUTILS_MODULE_H |
79 | static const int MODUTILS_MODULE_H = 1; | 79 | static const int MODUTILS_MODULE_H = 1; |
80 | 80 | ||
81 | #ident "$Id: insmod.c,v 1.39 2001/01/24 23:59:50 andersen Exp $" | 81 | #ident "$Id: insmod.c,v 1.40 2001/01/25 04:11:06 andersen Exp $" |
82 | 82 | ||
83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
84 | We do not use the kernel headers directly because we do not wish | 84 | We do not use the kernel headers directly because we do not wish |
@@ -284,7 +284,7 @@ int delete_module(const char *); | |||
284 | #ifndef MODUTILS_OBJ_H | 284 | #ifndef MODUTILS_OBJ_H |
285 | static const int MODUTILS_OBJ_H = 1; | 285 | static const int MODUTILS_OBJ_H = 1; |
286 | 286 | ||
287 | #ident "$Id: insmod.c,v 1.39 2001/01/24 23:59:50 andersen Exp $" | 287 | #ident "$Id: insmod.c,v 1.40 2001/01/25 04:11:06 andersen Exp $" |
288 | 288 | ||
289 | /* The relocatable object is manipulated using elfin types. */ | 289 | /* The relocatable object is manipulated using elfin types. */ |
290 | 290 | ||
@@ -2889,7 +2889,7 @@ extern int insmod_main( int argc, char **argv) | |||
2889 | #endif | 2889 | #endif |
2890 | 2890 | ||
2891 | /* Parse any options */ | 2891 | /* Parse any options */ |
2892 | while ((opt = getopt(argc, argv, "fkvxL")) > 0) { | 2892 | while ((opt = getopt(argc, argv, "fkvxLo:")) > 0) { |
2893 | switch (opt) { | 2893 | switch (opt) { |
2894 | case 'f': /* force loading */ | 2894 | case 'f': /* force loading */ |
2895 | flag_force_load = 1; | 2895 | flag_force_load = 1; |
@@ -2903,6 +2903,9 @@ extern int insmod_main( int argc, char **argv) | |||
2903 | case 'x': /* do not export externs */ | 2903 | case 'x': /* do not export externs */ |
2904 | flag_export = 0; | 2904 | flag_export = 0; |
2905 | break; | 2905 | break; |
2906 | case 'o': /* name the output module */ | ||
2907 | strncpy(m_name, optarg, BUFSIZ); | ||
2908 | break; | ||
2906 | case 'L': /* Stub warning */ | 2909 | case 'L': /* Stub warning */ |
2907 | /* This is needed for compatibility with modprobe. | 2910 | /* This is needed for compatibility with modprobe. |
2908 | * In theory, this does locking, but we don't do | 2911 | * In theory, this does locking, but we don't do |
@@ -2928,9 +2931,11 @@ extern int insmod_main( int argc, char **argv) | |||
2928 | 2931 | ||
2929 | if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') | 2932 | if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') |
2930 | len -= 2; | 2933 | len -= 2; |
2931 | memcpy(m_name, tmp, len); | 2934 | strncpy(m_fullName, tmp, len); |
2932 | strcpy(m_fullName, m_name); | ||
2933 | strcat(m_fullName, ".o"); | 2935 | strcat(m_fullName, ".o"); |
2936 | if (m_name == NULL) { | ||
2937 | memcpy(m_name, tmp, len); | ||
2938 | } | ||
2934 | 2939 | ||
2935 | /* Get a filedesc for the module */ | 2940 | /* Get a filedesc for the module */ |
2936 | if ((fp = fopen(argv[optind], "r")) == NULL) { | 2941 | if ((fp = fopen(argv[optind], "r")) == NULL) { |
diff --git a/modutils/insmod.c b/modutils/insmod.c index fc49dcd34..c51ee4f32 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -78,7 +78,7 @@ | |||
78 | #ifndef MODUTILS_MODULE_H | 78 | #ifndef MODUTILS_MODULE_H |
79 | static const int MODUTILS_MODULE_H = 1; | 79 | static const int MODUTILS_MODULE_H = 1; |
80 | 80 | ||
81 | #ident "$Id: insmod.c,v 1.39 2001/01/24 23:59:50 andersen Exp $" | 81 | #ident "$Id: insmod.c,v 1.40 2001/01/25 04:11:06 andersen Exp $" |
82 | 82 | ||
83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
84 | We do not use the kernel headers directly because we do not wish | 84 | We do not use the kernel headers directly because we do not wish |
@@ -284,7 +284,7 @@ int delete_module(const char *); | |||
284 | #ifndef MODUTILS_OBJ_H | 284 | #ifndef MODUTILS_OBJ_H |
285 | static const int MODUTILS_OBJ_H = 1; | 285 | static const int MODUTILS_OBJ_H = 1; |
286 | 286 | ||
287 | #ident "$Id: insmod.c,v 1.39 2001/01/24 23:59:50 andersen Exp $" | 287 | #ident "$Id: insmod.c,v 1.40 2001/01/25 04:11:06 andersen Exp $" |
288 | 288 | ||
289 | /* The relocatable object is manipulated using elfin types. */ | 289 | /* The relocatable object is manipulated using elfin types. */ |
290 | 290 | ||
@@ -2889,7 +2889,7 @@ extern int insmod_main( int argc, char **argv) | |||
2889 | #endif | 2889 | #endif |
2890 | 2890 | ||
2891 | /* Parse any options */ | 2891 | /* Parse any options */ |
2892 | while ((opt = getopt(argc, argv, "fkvxL")) > 0) { | 2892 | while ((opt = getopt(argc, argv, "fkvxLo:")) > 0) { |
2893 | switch (opt) { | 2893 | switch (opt) { |
2894 | case 'f': /* force loading */ | 2894 | case 'f': /* force loading */ |
2895 | flag_force_load = 1; | 2895 | flag_force_load = 1; |
@@ -2903,6 +2903,9 @@ extern int insmod_main( int argc, char **argv) | |||
2903 | case 'x': /* do not export externs */ | 2903 | case 'x': /* do not export externs */ |
2904 | flag_export = 0; | 2904 | flag_export = 0; |
2905 | break; | 2905 | break; |
2906 | case 'o': /* name the output module */ | ||
2907 | strncpy(m_name, optarg, BUFSIZ); | ||
2908 | break; | ||
2906 | case 'L': /* Stub warning */ | 2909 | case 'L': /* Stub warning */ |
2907 | /* This is needed for compatibility with modprobe. | 2910 | /* This is needed for compatibility with modprobe. |
2908 | * In theory, this does locking, but we don't do | 2911 | * In theory, this does locking, but we don't do |
@@ -2928,9 +2931,11 @@ extern int insmod_main( int argc, char **argv) | |||
2928 | 2931 | ||
2929 | if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') | 2932 | if (len > 2 && tmp[len - 2] == '.' && tmp[len - 1] == 'o') |
2930 | len -= 2; | 2933 | len -= 2; |
2931 | memcpy(m_name, tmp, len); | 2934 | strncpy(m_fullName, tmp, len); |
2932 | strcpy(m_fullName, m_name); | ||
2933 | strcat(m_fullName, ".o"); | 2935 | strcat(m_fullName, ".o"); |
2936 | if (m_name == NULL) { | ||
2937 | memcpy(m_name, tmp, len); | ||
2938 | } | ||
2934 | 2939 | ||
2935 | /* Get a filedesc for the module */ | 2940 | /* Get a filedesc for the module */ |
2936 | if ((fp = fopen(argv[optind], "r")) == NULL) { | 2941 | if ((fp = fopen(argv[optind], "r")) == NULL) { |