diff options
| author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-10-30 17:22:04 +0000 |
|---|---|---|
| committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-10-30 17:22:04 +0000 |
| commit | 4f7f0376c63e8db1497fa585e40d93e3b52124ff (patch) | |
| tree | d7531d36a1dcd27c47d26707170c4711b0c73aae /util-linux | |
| parent | 9b22b9a6b7af1b6c4364f67d578597ebc30b8f03 (diff) | |
| download | busybox-w32-4f7f0376c63e8db1497fa585e40d93e3b52124ff.tar.gz busybox-w32-4f7f0376c63e8db1497fa585e40d93e3b52124ff.tar.bz2 busybox-w32-4f7f0376c63e8db1497fa585e40d93e3b52124ff.zip | |
Fix uname problem that was breaking poweroff.
git-svn-id: svn://busybox.net/trunk/busybox@1275 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/mkswap.c | 18 | ||||
| -rw-r--r-- | util-linux/nfsmount.c | 18 |
2 files changed, 4 insertions, 32 deletions
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 8a9767cca..627d04f60 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c | |||
| @@ -63,20 +63,6 @@ static int version = -1; | |||
| 63 | 63 | ||
| 64 | #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) | 64 | #define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) |
| 65 | 65 | ||
| 66 | static int linux_version_code(void) | ||
| 67 | { | ||
| 68 | struct utsname my_utsname; | ||
| 69 | int p, q, r; | ||
| 70 | |||
| 71 | if (uname(&my_utsname) == 0) { | ||
| 72 | p = atoi(strtok(my_utsname.release, ".")); | ||
| 73 | q = atoi(strtok(NULL, ".")); | ||
| 74 | r = atoi(strtok(NULL, ".")); | ||
| 75 | return MAKE_VERSION(p, q, r); | ||
| 76 | } | ||
| 77 | return 0; | ||
| 78 | } | ||
| 79 | |||
| 80 | /* | 66 | /* |
| 81 | * The definition of the union swap_header uses the constant PAGE_SIZE. | 67 | * The definition of the union swap_header uses the constant PAGE_SIZE. |
| 82 | * Unfortunately, on some architectures this depends on the hardware model, | 68 | * Unfortunately, on some architectures this depends on the hardware model, |
| @@ -345,7 +331,7 @@ int mkswap_main(int argc, char **argv) | |||
| 345 | if (version == -1) { | 331 | if (version == -1) { |
| 346 | if (PAGES <= V0_MAX_PAGES) | 332 | if (PAGES <= V0_MAX_PAGES) |
| 347 | version = 0; | 333 | version = 0; |
| 348 | else if (linux_version_code() < MAKE_VERSION(2, 1, 117)) | 334 | else if (get_kernel_revision() < MAKE_VERSION(2, 1, 117)) |
| 349 | version = 0; | 335 | version = 0; |
| 350 | else if (pagesize < 2048) | 336 | else if (pagesize < 2048) |
| 351 | version = 0; | 337 | version = 0; |
| @@ -366,7 +352,7 @@ int mkswap_main(int argc, char **argv) | |||
| 366 | #else | 352 | #else |
| 367 | if (!version) | 353 | if (!version) |
| 368 | maxpages = V0_MAX_PAGES; | 354 | maxpages = V0_MAX_PAGES; |
| 369 | else if (linux_version_code() >= MAKE_VERSION(2, 2, 1)) | 355 | else if (get_kernel_revision() >= MAKE_VERSION(2, 2, 1)) |
| 370 | maxpages = V1_MAX_PAGES; | 356 | maxpages = V1_MAX_PAGES; |
| 371 | else { | 357 | else { |
| 372 | maxpages = V1_OLD_MAX_PAGES; | 358 | maxpages = V1_OLD_MAX_PAGES; |
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index abae19afe..f8735e52c 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c | |||
| @@ -160,20 +160,6 @@ static char *nfs_strerror(int stat); | |||
| 160 | #define EX_BG 256 /* retry in background (internal only) */ | 160 | #define EX_BG 256 /* retry in background (internal only) */ |
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | static int | ||
| 164 | linux_version_code(void) { | ||
| 165 | struct utsname my_utsname; | ||
| 166 | int p, q, r; | ||
| 167 | |||
| 168 | if (uname(&my_utsname) == 0) { | ||
| 169 | p = atoi(strtok(my_utsname.release, ".")); | ||
| 170 | q = atoi(strtok(NULL, ".")); | ||
| 171 | r = atoi(strtok(NULL, ".")); | ||
| 172 | return MAKE_VERSION(p,q,r); | ||
| 173 | } | ||
| 174 | return 0; | ||
| 175 | } | ||
| 176 | |||
| 177 | /* | 163 | /* |
| 178 | * nfs_mount_version according to the sources seen at compile time. | 164 | * nfs_mount_version according to the sources seen at compile time. |
| 179 | */ | 165 | */ |
| @@ -197,7 +183,7 @@ find_kernel_nfs_mount_version(void) { | |||
| 197 | if (kernel_version) | 183 | if (kernel_version) |
| 198 | return; | 184 | return; |
| 199 | 185 | ||
| 200 | kernel_version = linux_version_code(); | 186 | kernel_version = get_kernel_revision(); |
| 201 | 187 | ||
| 202 | if (kernel_version) { | 188 | if (kernel_version) { |
| 203 | if (kernel_version < MAKE_VERSION(2,1,32)) | 189 | if (kernel_version < MAKE_VERSION(2,1,32)) |
| @@ -796,7 +782,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
| 796 | * to avoid problems with multihomed hosts. | 782 | * to avoid problems with multihomed hosts. |
| 797 | * --Swen | 783 | * --Swen |
| 798 | */ | 784 | */ |
| 799 | if (linux_version_code() <= 66314 | 785 | if (get_kernel_revision() <= 66314 |
| 800 | && connect(fsock, (struct sockaddr *) &server_addr, | 786 | && connect(fsock, (struct sockaddr *) &server_addr, |
| 801 | sizeof (server_addr)) < 0) { | 787 | sizeof (server_addr)) < 0) { |
| 802 | perror(_("nfs connect")); | 788 | perror(_("nfs connect")); |
