aboutsummaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-01-25 04:11:06 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-01-25 04:11:06 +0000
commitfba5c8f753dc822b3552927b736c6fd0e2619a92 (patch)
tree86a71a2956eb83164a6c98743d75938ee596e38a /modutils
parent25f9a03b1094fd3af51629471088e9391ecab890 (diff)
downloadbusybox-w32-fba5c8f753dc822b3552927b736c6fd0e2619a92.tar.gz
busybox-w32-fba5c8f753dc822b3552927b736c6fd0e2619a92.tar.bz2
busybox-w32-fba5c8f753dc822b3552927b736c6fd0e2619a92.zip
I just wrote 'insmod -o' to close bug#1049.
git-svn-id: svn://busybox.net/trunk/busybox@1665 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'modutils')
-rw-r--r--modutils/insmod.c15
1 files changed, 10 insertions, 5 deletions
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
79static const int MODUTILS_MODULE_H = 1; 79static 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
285static const int MODUTILS_OBJ_H = 1; 285static 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) {