swapon: with no arguments, show /proc/swaps (mimic util-linux 2.41.1)
function old new delta swap_on_off_main 419 449 +30 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
1 parent
e8cb0a1d14
commit
e6302b2711
1 file changed
+5
@@ -323,6 +323,11 @@ int swap_on_off_main(int argc UNUSED_PARAM, char **argv)
|
||||
ret = do_all_in_proc_swaps();
|
||||
ret |= do_em_all_in_fstab();
|
||||
} else if (!*argv) {
|
||||
if (!do_swapoff) {
|
||||
/* bare "swapon" shows current swap usage */
|
||||
*--argv = (char*)"/proc/swaps";
|
||||
return bb_cat(argv);
|
||||
}
|
||||
/* if not -a we need at least one arg */
|
||||
bb_show_usage();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user