diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-06-07 17:28:53 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-06-07 17:28:53 +0000 |
commit | a42982e8f569417e93bc3b47c501cbe83a5bfade (patch) | |
tree | a28be75735aa78f38cf8464f874857fd0132c664 | |
parent | 1f6262b8e2b4225a028b016fed4a3a9ee717b540 (diff) | |
download | busybox-w32-a42982e8f569417e93bc3b47c501cbe83a5bfade.tar.gz busybox-w32-a42982e8f569417e93bc3b47c501cbe83a5bfade.tar.bz2 busybox-w32-a42982e8f569417e93bc3b47c501cbe83a5bfade.zip |
* Fixed 'swapon -a' and 'swapoff -a', which were broken.
* Fixed 'mount -a' so it works as expected.
* Implemented 'ls -R' (enabled by enabling BB_FEATURE_LS_RECURSIVE)
-Erik
-rw-r--r-- | Changelog | 3 | ||||
-rw-r--r-- | TODO | 7 | ||||
-rw-r--r-- | busybox.def.h | 3 | ||||
-rw-r--r-- | coreutils/ls.c | 51 | ||||
-rw-r--r-- | docs/busybox.pod | 5 | ||||
-rw-r--r-- | ls.c | 51 | ||||
-rw-r--r-- | mount.c | 27 | ||||
-rw-r--r-- | swaponoff.c | 2 | ||||
-rw-r--r-- | util-linux/mount.c | 27 | ||||
-rw-r--r-- | util-linux/swaponoff.c | 2 |
10 files changed, 125 insertions, 53 deletions
@@ -60,6 +60,9 @@ | |||
60 | * "mount" now reports errors from nfsmount() and assumes NFS mount | 60 | * "mount" now reports errors from nfsmount() and assumes NFS mount |
61 | if ':' is present in the device name - Pavel Roskin | 61 | if ':' is present in the device name - Pavel Roskin |
62 | * Fixed exit status for killall - Pavel Roskin | 62 | * Fixed exit status for killall - Pavel Roskin |
63 | * Fixed 'swapon -a' and 'swapoff -a', which were broken. | ||
64 | * Fixed 'mount -a' so it works as expected. | ||
65 | * Implemented 'ls -R' (enabled by enabling BB_FEATURE_LS_RECURSIVE) | ||
63 | * More doc updates | 66 | * More doc updates |
64 | 67 | ||
65 | 68 | ||
@@ -18,19 +18,12 @@ around to it some time. If you have any good ideas, please let me know. | |||
18 | 18 | ||
19 | Bugs that need fixing before the 0.44 release goes out the door: | 19 | Bugs that need fixing before the 0.44 release goes out the door: |
20 | 20 | ||
21 | - mkfs.minix rev 1.7 completely broke the parser. Fix it. | ||
22 | - 'grep foo$ file' doesn't work | 21 | - 'grep foo$ file' doesn't work |
23 | - 'grep *foo file' segfaults | 22 | - 'grep *foo file' segfaults |
24 | - ps dirent race bug (need to stat the file before attempting chdir) | 23 | - ps dirent race bug (need to stat the file before attempting chdir) |
25 | - I believe that swaponoff may also be also broken (check it). | ||
26 | - It used to be that BusyBox tar would happily overwrite existing files on | ||
27 | an extraction. However, as of 0.42, BusyBox tar simply dies as soon as an | ||
28 | existing file is found. | ||
29 | - Make 'mount -a' work even when /proc isn't mounted (ugly bug). | ||
30 | - Make 'ln -s /tmp/file .' work the way GNU ln does (i.e. makes a link to | 24 | - Make 'ln -s /tmp/file .' work the way GNU ln does (i.e. makes a link to |
31 | /tmp/file in the current directory, rather then trying and failing to create | 25 | /tmp/file in the current directory, rather then trying and failing to create |
32 | a symlink named "." in the current working directory). | 26 | a symlink named "." in the current working directory). |
33 | - implement 'ls -R'. | ||
34 | - "math" should also take input from stdin | 27 | - "math" should also take input from stdin |
35 | - "more" doesn't accept " " to scroll by one page when BB_FEATURE_USE_TERMIOS | 28 | - "more" doesn't accept " " to scroll by one page when BB_FEATURE_USE_TERMIOS |
36 | is not on. | 29 | is not on. |
diff --git a/busybox.def.h b/busybox.def.h index 3b7c8bf26..11a791ef4 100644 --- a/busybox.def.h +++ b/busybox.def.h | |||
@@ -154,6 +154,9 @@ | |||
154 | // enable ls -p and -F | 154 | // enable ls -p and -F |
155 | #define BB_FEATURE_LS_FILETYPES | 155 | #define BB_FEATURE_LS_FILETYPES |
156 | // | 156 | // |
157 | // enable ls -R | ||
158 | #define BB_FEATURE_LS_RECURSIVE | ||
159 | // | ||
157 | // Change ping implementation -- simplified, featureless, but really small. | 160 | // Change ping implementation -- simplified, featureless, but really small. |
158 | //#define BB_SIMPLE_PING | 161 | //#define BB_SIMPLE_PING |
159 | // | 162 | // |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 6ab11c4e5..0b1aa6221 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -86,8 +86,9 @@ | |||
86 | #define DISP_DOT 8 /* show . and .. */ | 86 | #define DISP_DOT 8 /* show . and .. */ |
87 | #define DISP_NUMERIC 16 /* numeric uid and gid */ | 87 | #define DISP_NUMERIC 16 /* numeric uid and gid */ |
88 | #define DISP_FULLTIME 32 /* show extended time display */ | 88 | #define DISP_FULLTIME 32 /* show extended time display */ |
89 | #define DIR_NOLIST 64 /* show directory as itself, not contents */ | 89 | #define DIR_NOLIST 64 /* show directory as itself, not contents */ |
90 | #define DISP_DIRNAME 128 /* show directory name (for internal use) */ | 90 | #define DISP_DIRNAME 128 /* show directory name (for internal use) */ |
91 | #define DISP_RECURSIVE 256 /* Do a recursive listing */ | ||
91 | 92 | ||
92 | #ifndef MAJOR | 93 | #ifndef MAJOR |
93 | #define MAJOR(dev) (((dev)>>8)&0xff) | 94 | #define MAJOR(dev) (((dev)>>8)&0xff) |
@@ -449,6 +450,9 @@ static const char ls_usage[] = "ls [-1a" | |||
449 | #ifdef BB_FEATURE_LS_FILETYPES | 450 | #ifdef BB_FEATURE_LS_FILETYPES |
450 | "F" | 451 | "F" |
451 | #endif | 452 | #endif |
453 | #ifdef BB_FEATURE_LS_RECURSIVE | ||
454 | "R" | ||
455 | #endif | ||
452 | "] [filenames...]\n" | 456 | "] [filenames...]\n" |
453 | #ifndef BB_FEATURE_TRIVIAL_HELP | 457 | #ifndef BB_FEATURE_TRIVIAL_HELP |
454 | "\nList directory contents\n\n" | 458 | "\nList directory contents\n\n" |
@@ -477,9 +481,24 @@ static const char ls_usage[] = "ls [-1a" | |||
477 | #ifdef BB_FEATURE_LS_FILETYPES | 481 | #ifdef BB_FEATURE_LS_FILETYPES |
478 | "\t-F\tappend indicator (one of */=@|) to entries\n" | 482 | "\t-F\tappend indicator (one of */=@|) to entries\n" |
479 | #endif | 483 | #endif |
484 | #ifdef BB_FEATURE_LS_RECURSIVE | ||
485 | "\t-R\tlist subdirectories recursively\n" | ||
486 | #endif | ||
480 | #endif | 487 | #endif |
481 | ; | 488 | ; |
482 | 489 | ||
490 | |||
491 | #ifdef BB_FEATURE_LS_RECURSIVE | ||
492 | static int dirAction(const char *fileName, struct stat *statbuf, void* junk) | ||
493 | { | ||
494 | int i; | ||
495 | fprintf(stdout, "\n%s:\n", fileName); | ||
496 | i = list_item(fileName); | ||
497 | newline(); | ||
498 | return (i); | ||
499 | } | ||
500 | #endif | ||
501 | |||
483 | extern int ls_main(int argc, char **argv) | 502 | extern int ls_main(int argc, char **argv) |
484 | { | 503 | { |
485 | int argi = 1, i; | 504 | int argi = 1, i; |
@@ -544,6 +563,11 @@ extern int ls_main(int argc, char **argv) | |||
544 | opts |= DISP_FULLTIME; | 563 | opts |= DISP_FULLTIME; |
545 | break; | 564 | break; |
546 | #endif | 565 | #endif |
566 | #ifdef BB_FEATURE_LS_RECURSIVE | ||
567 | case 'R': | ||
568 | opts |= DISP_RECURSIVE; | ||
569 | break; | ||
570 | #endif | ||
547 | default: | 571 | default: |
548 | goto print_usage_message; | 572 | goto print_usage_message; |
549 | } | 573 | } |
@@ -570,12 +594,25 @@ extern int ls_main(int argc, char **argv) | |||
570 | #endif | 594 | #endif |
571 | 595 | ||
572 | /* process files specified, or current directory if none */ | 596 | /* process files specified, or current directory if none */ |
573 | i = 0; | 597 | #ifdef BB_FEATURE_LS_RECURSIVE |
574 | if (argi == argc) | 598 | if (opts & DISP_RECURSIVE) { |
575 | i = list_item("."); | 599 | i = 0; |
576 | while (argi < argc) | 600 | if (argi == argc) { |
577 | i |= list_item(argv[argi++]); | 601 | i = recursiveAction(".", TRUE, FALSE, FALSE, NULL, dirAction, NULL); |
578 | newline(); | 602 | } |
603 | while (argi < argc) { | ||
604 | i |= recursiveAction(argv[argi++], TRUE, FALSE, FALSE, NULL, dirAction, NULL); | ||
605 | } | ||
606 | } else | ||
607 | #endif | ||
608 | { | ||
609 | i = 0; | ||
610 | if (argi == argc) | ||
611 | i = list_item("."); | ||
612 | while (argi < argc) | ||
613 | i |= list_item(argv[argi++]); | ||
614 | newline(); | ||
615 | } | ||
579 | exit(i); | 616 | exit(i); |
580 | 617 | ||
581 | print_usage_message: | 618 | print_usage_message: |
diff --git a/docs/busybox.pod b/docs/busybox.pod index 7b76e7e79..3cd45f7bd 100644 --- a/docs/busybox.pod +++ b/docs/busybox.pod | |||
@@ -956,7 +956,7 @@ Example: | |||
956 | 956 | ||
957 | =item ls | 957 | =item ls |
958 | 958 | ||
959 | Usage: ls [B<-1acdelnpuxACF>] [filenames...] | 959 | Usage: ls [B<-1acdelnpuxACFR>] [filenames...] |
960 | 960 | ||
961 | Options: | 961 | Options: |
962 | 962 | ||
@@ -974,6 +974,7 @@ Options: | |||
974 | -A do not list implied . and .. | 974 | -A do not list implied . and .. |
975 | -C list entries by columns | 975 | -C list entries by columns |
976 | -F append indicator (one of */=@|) to entries | 976 | -F append indicator (one of */=@|) to entries |
977 | -R list subdirectories recursively | ||
977 | 978 | ||
978 | ------------------------------- | 979 | ------------------------------- |
979 | 980 | ||
@@ -1947,4 +1948,4 @@ Enrique Zanardi <ezanardi@ull.es> | |||
1947 | 1948 | ||
1948 | =cut | 1949 | =cut |
1949 | 1950 | ||
1950 | # $Id: busybox.pod,v 1.35 2000/06/06 16:15:23 andersen Exp $ | 1951 | # $Id: busybox.pod,v 1.36 2000/06/07 17:28:53 andersen Exp $ |
@@ -86,8 +86,9 @@ | |||
86 | #define DISP_DOT 8 /* show . and .. */ | 86 | #define DISP_DOT 8 /* show . and .. */ |
87 | #define DISP_NUMERIC 16 /* numeric uid and gid */ | 87 | #define DISP_NUMERIC 16 /* numeric uid and gid */ |
88 | #define DISP_FULLTIME 32 /* show extended time display */ | 88 | #define DISP_FULLTIME 32 /* show extended time display */ |
89 | #define DIR_NOLIST 64 /* show directory as itself, not contents */ | 89 | #define DIR_NOLIST 64 /* show directory as itself, not contents */ |
90 | #define DISP_DIRNAME 128 /* show directory name (for internal use) */ | 90 | #define DISP_DIRNAME 128 /* show directory name (for internal use) */ |
91 | #define DISP_RECURSIVE 256 /* Do a recursive listing */ | ||
91 | 92 | ||
92 | #ifndef MAJOR | 93 | #ifndef MAJOR |
93 | #define MAJOR(dev) (((dev)>>8)&0xff) | 94 | #define MAJOR(dev) (((dev)>>8)&0xff) |
@@ -449,6 +450,9 @@ static const char ls_usage[] = "ls [-1a" | |||
449 | #ifdef BB_FEATURE_LS_FILETYPES | 450 | #ifdef BB_FEATURE_LS_FILETYPES |
450 | "F" | 451 | "F" |
451 | #endif | 452 | #endif |
453 | #ifdef BB_FEATURE_LS_RECURSIVE | ||
454 | "R" | ||
455 | #endif | ||
452 | "] [filenames...]\n" | 456 | "] [filenames...]\n" |
453 | #ifndef BB_FEATURE_TRIVIAL_HELP | 457 | #ifndef BB_FEATURE_TRIVIAL_HELP |
454 | "\nList directory contents\n\n" | 458 | "\nList directory contents\n\n" |
@@ -477,9 +481,24 @@ static const char ls_usage[] = "ls [-1a" | |||
477 | #ifdef BB_FEATURE_LS_FILETYPES | 481 | #ifdef BB_FEATURE_LS_FILETYPES |
478 | "\t-F\tappend indicator (one of */=@|) to entries\n" | 482 | "\t-F\tappend indicator (one of */=@|) to entries\n" |
479 | #endif | 483 | #endif |
484 | #ifdef BB_FEATURE_LS_RECURSIVE | ||
485 | "\t-R\tlist subdirectories recursively\n" | ||
486 | #endif | ||
480 | #endif | 487 | #endif |
481 | ; | 488 | ; |
482 | 489 | ||
490 | |||
491 | #ifdef BB_FEATURE_LS_RECURSIVE | ||
492 | static int dirAction(const char *fileName, struct stat *statbuf, void* junk) | ||
493 | { | ||
494 | int i; | ||
495 | fprintf(stdout, "\n%s:\n", fileName); | ||
496 | i = list_item(fileName); | ||
497 | newline(); | ||
498 | return (i); | ||
499 | } | ||
500 | #endif | ||
501 | |||
483 | extern int ls_main(int argc, char **argv) | 502 | extern int ls_main(int argc, char **argv) |
484 | { | 503 | { |
485 | int argi = 1, i; | 504 | int argi = 1, i; |
@@ -544,6 +563,11 @@ extern int ls_main(int argc, char **argv) | |||
544 | opts |= DISP_FULLTIME; | 563 | opts |= DISP_FULLTIME; |
545 | break; | 564 | break; |
546 | #endif | 565 | #endif |
566 | #ifdef BB_FEATURE_LS_RECURSIVE | ||
567 | case 'R': | ||
568 | opts |= DISP_RECURSIVE; | ||
569 | break; | ||
570 | #endif | ||
547 | default: | 571 | default: |
548 | goto print_usage_message; | 572 | goto print_usage_message; |
549 | } | 573 | } |
@@ -570,12 +594,25 @@ extern int ls_main(int argc, char **argv) | |||
570 | #endif | 594 | #endif |
571 | 595 | ||
572 | /* process files specified, or current directory if none */ | 596 | /* process files specified, or current directory if none */ |
573 | i = 0; | 597 | #ifdef BB_FEATURE_LS_RECURSIVE |
574 | if (argi == argc) | 598 | if (opts & DISP_RECURSIVE) { |
575 | i = list_item("."); | 599 | i = 0; |
576 | while (argi < argc) | 600 | if (argi == argc) { |
577 | i |= list_item(argv[argi++]); | 601 | i = recursiveAction(".", TRUE, FALSE, FALSE, NULL, dirAction, NULL); |
578 | newline(); | 602 | } |
603 | while (argi < argc) { | ||
604 | i |= recursiveAction(argv[argi++], TRUE, FALSE, FALSE, NULL, dirAction, NULL); | ||
605 | } | ||
606 | } else | ||
607 | #endif | ||
608 | { | ||
609 | i = 0; | ||
610 | if (argi == argc) | ||
611 | i = list_item("."); | ||
612 | while (argi < argc) | ||
613 | i |= list_item(argv[argi++]); | ||
614 | newline(); | ||
615 | } | ||
579 | exit(i); | 616 | exit(i); |
580 | 617 | ||
581 | print_usage_message: | 618 | print_usage_message: |
@@ -154,8 +154,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
154 | } | 154 | } |
155 | } | 155 | } |
156 | #endif | 156 | #endif |
157 | status = | 157 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); |
158 | mount(specialfile, dir, filesystemtype, flags, string_flags); | ||
159 | } | 158 | } |
160 | 159 | ||
161 | 160 | ||
@@ -176,6 +175,11 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
176 | del_loop(specialfile); | 175 | del_loop(specialfile); |
177 | } | 176 | } |
178 | #endif | 177 | #endif |
178 | |||
179 | if (errno == EPERM) { | ||
180 | fatalError("mount: permission denied. Are you root?\n"); | ||
181 | } | ||
182 | |||
179 | return (FALSE); | 183 | return (FALSE); |
180 | } | 184 | } |
181 | 185 | ||
@@ -307,7 +311,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
307 | fakeIt, mtab_opts); | 311 | fakeIt, mtab_opts); |
308 | } | 312 | } |
309 | 313 | ||
310 | if (status == FALSE && whineOnErrors == TRUE) { | 314 | if (status == FALSE) { |
311 | if (whineOnErrors == TRUE) { | 315 | if (whineOnErrors == TRUE) { |
312 | fprintf(stderr, "Mounting %s on %s failed: %s\n", | 316 | fprintf(stderr, "Mounting %s on %s failed: %s\n", |
313 | blockDevice, directory, strerror(errno)); | 317 | blockDevice, directory, strerror(errno)); |
@@ -458,24 +462,19 @@ extern int mount_main(int argc, char **argv) | |||
458 | // If the filesystem isn't noauto, | 462 | // If the filesystem isn't noauto, |
459 | // and isn't swap or nfs, then mount it | 463 | // and isn't swap or nfs, then mount it |
460 | if ((!strstr(m->mnt_opts, "noauto")) && | 464 | if ((!strstr(m->mnt_opts, "noauto")) && |
461 | (!strstr(m->mnt_type, "swap")) && | 465 | (!strstr(m->mnt_type, "swap")) && |
462 | (!strstr(m->mnt_type, "nfs"))) { | 466 | (!strstr(m->mnt_type, "nfs"))) { |
463 | flags = 0; | 467 | flags = 0; |
464 | *string_flags = '\0'; | 468 | *string_flags = '\0'; |
465 | parse_mount_options(m->mnt_opts, &flags, string_flags); | 469 | parse_mount_options(m->mnt_opts, &flags, string_flags); |
466 | /* If the directory is /, try to remount | ||
467 | * with the options specified in fstab */ | ||
468 | if (m->mnt_dir[0] == '/' && m->mnt_dir[1] == '\0') { | ||
469 | flags |= MS_REMOUNT; | ||
470 | } | ||
471 | if (mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, | 470 | if (mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, |
472 | flags, string_flags, useMtab, fakeIt, | 471 | flags, string_flags, useMtab, fakeIt, |
473 | extra_opts, FALSE)) | 472 | extra_opts, FALSE)==FALSE) |
474 | { | 473 | { |
475 | /* Try again, but this time try a remount */ | 474 | /* Try again, but this time try a remount */ |
476 | mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, | 475 | mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, |
477 | flags|MS_REMOUNT, string_flags, useMtab, fakeIt, | 476 | flags|MS_REMOUNT, string_flags, useMtab, fakeIt, |
478 | extra_opts, TRUE); | 477 | extra_opts, TRUE); |
479 | } | 478 | } |
480 | } | 479 | } |
481 | } | 480 | } |
diff --git a/swaponoff.c b/swaponoff.c index 0f8c4f5f3..83aadd08a 100644 --- a/swaponoff.c +++ b/swaponoff.c | |||
@@ -83,7 +83,7 @@ static void do_em_all() | |||
83 | exit(FALSE); | 83 | exit(FALSE); |
84 | } | 84 | } |
85 | while ((m = getmntent(f)) != NULL) { | 85 | while ((m = getmntent(f)) != NULL) { |
86 | if (!strstr(m->mnt_type, MNTTYPE_SWAP)) { | 86 | if (strcmp(m->mnt_type, MNTTYPE_SWAP)==0) { |
87 | swap_enable_disable(m->mnt_fsname); | 87 | swap_enable_disable(m->mnt_fsname); |
88 | } | 88 | } |
89 | } | 89 | } |
diff --git a/util-linux/mount.c b/util-linux/mount.c index ee6c9475a..76f048b1c 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -154,8 +154,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
154 | } | 154 | } |
155 | } | 155 | } |
156 | #endif | 156 | #endif |
157 | status = | 157 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); |
158 | mount(specialfile, dir, filesystemtype, flags, string_flags); | ||
159 | } | 158 | } |
160 | 159 | ||
161 | 160 | ||
@@ -176,6 +175,11 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
176 | del_loop(specialfile); | 175 | del_loop(specialfile); |
177 | } | 176 | } |
178 | #endif | 177 | #endif |
178 | |||
179 | if (errno == EPERM) { | ||
180 | fatalError("mount: permission denied. Are you root?\n"); | ||
181 | } | ||
182 | |||
179 | return (FALSE); | 183 | return (FALSE); |
180 | } | 184 | } |
181 | 185 | ||
@@ -307,7 +311,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
307 | fakeIt, mtab_opts); | 311 | fakeIt, mtab_opts); |
308 | } | 312 | } |
309 | 313 | ||
310 | if (status == FALSE && whineOnErrors == TRUE) { | 314 | if (status == FALSE) { |
311 | if (whineOnErrors == TRUE) { | 315 | if (whineOnErrors == TRUE) { |
312 | fprintf(stderr, "Mounting %s on %s failed: %s\n", | 316 | fprintf(stderr, "Mounting %s on %s failed: %s\n", |
313 | blockDevice, directory, strerror(errno)); | 317 | blockDevice, directory, strerror(errno)); |
@@ -458,24 +462,19 @@ extern int mount_main(int argc, char **argv) | |||
458 | // If the filesystem isn't noauto, | 462 | // If the filesystem isn't noauto, |
459 | // and isn't swap or nfs, then mount it | 463 | // and isn't swap or nfs, then mount it |
460 | if ((!strstr(m->mnt_opts, "noauto")) && | 464 | if ((!strstr(m->mnt_opts, "noauto")) && |
461 | (!strstr(m->mnt_type, "swap")) && | 465 | (!strstr(m->mnt_type, "swap")) && |
462 | (!strstr(m->mnt_type, "nfs"))) { | 466 | (!strstr(m->mnt_type, "nfs"))) { |
463 | flags = 0; | 467 | flags = 0; |
464 | *string_flags = '\0'; | 468 | *string_flags = '\0'; |
465 | parse_mount_options(m->mnt_opts, &flags, string_flags); | 469 | parse_mount_options(m->mnt_opts, &flags, string_flags); |
466 | /* If the directory is /, try to remount | ||
467 | * with the options specified in fstab */ | ||
468 | if (m->mnt_dir[0] == '/' && m->mnt_dir[1] == '\0') { | ||
469 | flags |= MS_REMOUNT; | ||
470 | } | ||
471 | if (mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, | 470 | if (mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, |
472 | flags, string_flags, useMtab, fakeIt, | 471 | flags, string_flags, useMtab, fakeIt, |
473 | extra_opts, FALSE)) | 472 | extra_opts, FALSE)==FALSE) |
474 | { | 473 | { |
475 | /* Try again, but this time try a remount */ | 474 | /* Try again, but this time try a remount */ |
476 | mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, | 475 | mount_one(m->mnt_fsname, m->mnt_dir, m->mnt_type, |
477 | flags|MS_REMOUNT, string_flags, useMtab, fakeIt, | 476 | flags|MS_REMOUNT, string_flags, useMtab, fakeIt, |
478 | extra_opts, TRUE); | 477 | extra_opts, TRUE); |
479 | } | 478 | } |
480 | } | 479 | } |
481 | } | 480 | } |
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 0f8c4f5f3..83aadd08a 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c | |||
@@ -83,7 +83,7 @@ static void do_em_all() | |||
83 | exit(FALSE); | 83 | exit(FALSE); |
84 | } | 84 | } |
85 | while ((m = getmntent(f)) != NULL) { | 85 | while ((m = getmntent(f)) != NULL) { |
86 | if (!strstr(m->mnt_type, MNTTYPE_SWAP)) { | 86 | if (strcmp(m->mnt_type, MNTTYPE_SWAP)==0) { |
87 | swap_enable_disable(m->mnt_fsname); | 87 | swap_enable_disable(m->mnt_fsname); |
88 | } | 88 | } |
89 | } | 89 | } |