summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog8
-rw-r--r--mkswap.c18
-rw-r--r--nfsmount.c18
-rw-r--r--util-linux/mkswap.c18
-rw-r--r--util-linux/nfsmount.c18
-rw-r--r--utility.c4
6 files changed, 19 insertions, 65 deletions
diff --git a/Changelog b/Changelog
index 8b4cf8b..4f6f619 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,11 @@
+0.48
+
+ * Fixed uname problem causing the kernel version to be
+ mis-detected (causing problems with poweroff, init,
+ and other things).
+
+ -Erik Andersen
+
0.47
* A bug in syslogd was fixed that allowed it to potentially fork-bomb
diff --git a/mkswap.c b/mkswap.c
index 8a9767c..627d04f 100644
--- a/mkswap.c
+++ b/mkswap.c
@@ -63,20 +63,6 @@ static int version = -1;
#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
-static int linux_version_code(void)
-{
- struct utsname my_utsname;
- int p, q, r;
-
- if (uname(&my_utsname) == 0) {
- p = atoi(strtok(my_utsname.release, "."));
- q = atoi(strtok(NULL, "."));
- r = atoi(strtok(NULL, "."));
- return MAKE_VERSION(p, q, r);
- }
- return 0;
-}
-
/*
* The definition of the union swap_header uses the constant PAGE_SIZE.
* Unfortunately, on some architectures this depends on the hardware model,
@@ -345,7 +331,7 @@ int mkswap_main(int argc, char **argv)
if (version == -1) {
if (PAGES <= V0_MAX_PAGES)
version = 0;
- else if (linux_version_code() < MAKE_VERSION(2, 1, 117))
+ else if (get_kernel_revision() < MAKE_VERSION(2, 1, 117))
version = 0;
else if (pagesize < 2048)
version = 0;
@@ -366,7 +352,7 @@ int mkswap_main(int argc, char **argv)
#else
if (!version)
maxpages = V0_MAX_PAGES;
- else if (linux_version_code() >= MAKE_VERSION(2, 2, 1))
+ else if (get_kernel_revision() >= MAKE_VERSION(2, 2, 1))
maxpages = V1_MAX_PAGES;
else {
maxpages = V1_OLD_MAX_PAGES;
diff --git a/nfsmount.c b/nfsmount.c
index abae19a..f8735e5 100644
--- a/nfsmount.c
+++ b/nfsmount.c
@@ -160,20 +160,6 @@ static char *nfs_strerror(int stat);
#define EX_BG 256 /* retry in background (internal only) */
-static int
-linux_version_code(void) {
- struct utsname my_utsname;
- int p, q, r;
-
- if (uname(&my_utsname) == 0) {
- p = atoi(strtok(my_utsname.release, "."));
- q = atoi(strtok(NULL, "."));
- r = atoi(strtok(NULL, "."));
- return MAKE_VERSION(p,q,r);
- }
- return 0;
-}
-
/*
* nfs_mount_version according to the sources seen at compile time.
*/
@@ -197,7 +183,7 @@ find_kernel_nfs_mount_version(void) {
if (kernel_version)
return;
- kernel_version = linux_version_code();
+ kernel_version = get_kernel_revision();
if (kernel_version) {
if (kernel_version < MAKE_VERSION(2,1,32))
@@ -796,7 +782,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
* to avoid problems with multihomed hosts.
* --Swen
*/
- if (linux_version_code() <= 66314
+ if (get_kernel_revision() <= 66314
&& connect(fsock, (struct sockaddr *) &server_addr,
sizeof (server_addr)) < 0) {
perror(_("nfs connect"));
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 8a9767c..627d04f 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -63,20 +63,6 @@ static int version = -1;
#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
-static int linux_version_code(void)
-{
- struct utsname my_utsname;
- int p, q, r;
-
- if (uname(&my_utsname) == 0) {
- p = atoi(strtok(my_utsname.release, "."));
- q = atoi(strtok(NULL, "."));
- r = atoi(strtok(NULL, "."));
- return MAKE_VERSION(p, q, r);
- }
- return 0;
-}
-
/*
* The definition of the union swap_header uses the constant PAGE_SIZE.
* Unfortunately, on some architectures this depends on the hardware model,
@@ -345,7 +331,7 @@ int mkswap_main(int argc, char **argv)
if (version == -1) {
if (PAGES <= V0_MAX_PAGES)
version = 0;
- else if (linux_version_code() < MAKE_VERSION(2, 1, 117))
+ else if (get_kernel_revision() < MAKE_VERSION(2, 1, 117))
version = 0;
else if (pagesize < 2048)
version = 0;
@@ -366,7 +352,7 @@ int mkswap_main(int argc, char **argv)
#else
if (!version)
maxpages = V0_MAX_PAGES;
- else if (linux_version_code() >= MAKE_VERSION(2, 2, 1))
+ else if (get_kernel_revision() >= MAKE_VERSION(2, 2, 1))
maxpages = V1_MAX_PAGES;
else {
maxpages = V1_OLD_MAX_PAGES;
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c
index abae19a..f8735e5 100644
--- a/util-linux/nfsmount.c
+++ b/util-linux/nfsmount.c
@@ -160,20 +160,6 @@ static char *nfs_strerror(int stat);
#define EX_BG 256 /* retry in background (internal only) */
-static int
-linux_version_code(void) {
- struct utsname my_utsname;
- int p, q, r;
-
- if (uname(&my_utsname) == 0) {
- p = atoi(strtok(my_utsname.release, "."));
- q = atoi(strtok(NULL, "."));
- r = atoi(strtok(NULL, "."));
- return MAKE_VERSION(p,q,r);
- }
- return 0;
-}
-
/*
* nfs_mount_version according to the sources seen at compile time.
*/
@@ -197,7 +183,7 @@ find_kernel_nfs_mount_version(void) {
if (kernel_version)
return;
- kernel_version = linux_version_code();
+ kernel_version = get_kernel_revision();
if (kernel_version) {
if (kernel_version < MAKE_VERSION(2,1,32))
@@ -796,7 +782,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
* to avoid problems with multihomed hosts.
* --Swen
*/
- if (linux_version_code() <= 66314
+ if (get_kernel_revision() <= 66314
&& connect(fsock, (struct sockaddr *) &server_addr,
sizeof (server_addr)) < 0) {
perror(_("nfs connect"));
diff --git a/utility.c b/utility.c
index d61ef30..235b582 100644
--- a/utility.c
+++ b/utility.c
@@ -156,7 +156,9 @@ extern int get_kernel_revision(void)
perror("cannot get system information");
return (0);
}
- sscanf(name.version, "%d.%d.%d", &major, &minor, &patch);
+ major = atoi(strtok(name.release, "."));
+ minor = atoi(strtok(NULL, "."));
+ patch = atoi(strtok(NULL, "."));
return major * 65536 + minor * 256 + patch;
}
#endif /* BB_INIT */