When -d option is used with swapon, is expected that there is an equal '=' which at least according to the man page it doesn't make sense or it's not properly explained. If we use -d as we should, then swapon takes 'once' or 'pages' as an actual device: dhcp33:~ # swapon -p -2 -d once /dev/sdb1 swapon: stat failed once: No such file or directory The short option -d, should be something like "swapon -d once ...." not "swapon -d=once ...." I've attached the patch to fix this small issue. -- Robert Milasan L3 Support Engineer SUSE Linux (http://www.suse.com) email: rmilasan@xxxxxxxx GPG fingerprint: B6FE F4A8 0FA3 3040 3402 6FE7 2F64 167C 1909 6D1A
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c index 8609ea2..20baea3 100644 --- a/sys-utils/swapon.c +++ b/sys-utils/swapon.c @@ -846,12 +846,9 @@ int main(int argc, char *argv[]) case 'd': discard |= SWAP_FLAG_DISCARD; if (optarg) { - if (*optarg == '=') - optarg++; - - if (strcmp(optarg, "once") == 0) + if (strncmp(optarg, "once", 4) == 0) discard |= SWAP_FLAG_DISCARD_ONCE; - else if (strcmp(optarg, "pages") == 0) + else if (strncmp(optarg, "pages", 5) == 0) discard |= SWAP_FLAG_DISCARD_PAGES; else errx(EXIT_FAILURE, _("unsupported discard policy: %s"), optarg);