summaryrefslogtreecommitdiff
path: root/modutils
diff options
context:
space:
mode:
authorRob Landley2005-11-27 19:01:53 +0000
committerRob Landley2005-11-27 19:01:53 +0000
commit52219874fe5db7440f78bc65179a8bd9a4b23192 (patch)
treedc24d99f04dc20e7304bf75d6f2bc6838c610e5f /modutils
parent350865e33979bdd2a5005939c214fb3d9f4bbc9d (diff)
downloadbusybox-52219874fe5db7440f78bc65179a8bd9a4b23192.zip
busybox-52219874fe5db7440f78bc65179a8bd9a4b23192.tar.gz
Patch from Cristian Ionescu-Idbohrn to deal with _ vs - better.
Diffstat (limited to 'modutils')
-rw-r--r--modutils/rmmod.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index f4e65d0..512221b 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -27,6 +27,7 @@
#include <getopt.h>
#include <fcntl.h>
#include <string.h>
+#include <sys/utsname.h>
#include <sys/syscall.h>
#include "busybox.h"
@@ -44,7 +45,16 @@ static inline void filename2modname(char *modname, const char *filename)
/* Convert to underscores, stop at first . */
for (i = 0; afterslash[i] && afterslash[i] != '.'; i++) {
- if (afterslash[i] == '-')
+ int kr_chk = 1;
+
+ if (ENABLE_FEATURE_2_4_MODULES) {
+ struct utsname uname_info;
+ if (uname(&uname_info) == -1)
+ bb_error_msg_and_die("cannot get uname data");
+ if (strcmp(uname_info.release, "2.6") < 0)
+ kr_chk = 0;
+ }
+ if (kr_chk && (afterslash[i] == '-'))
modname[i] = '_';
else
modname[i] = afterslash[i];