]> git.ipfire.org Git - thirdparty/util-linux.git/commit - sys-utils/swapon.c
swapon: fix discard option parsing
authorKarel Zak <kzak@redhat.com>
Wed, 21 Sep 2016 12:47:32 +0000 (14:47 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 21 Sep 2016 13:08:50 +0000 (15:08 +0200)
commit07332bfa1ec122a251194a62f91319841121d5aa
tree6dcb66f3c8cd81c191fb65ed53900ca84a74fe93
parent8f0c12f1c9d28e5399a1479db1f20e4295854303
swapon: fix discard option parsing

The current code does not work as expected if there is an option
behind the discard=<arg>, for example:

  swapon /dev/sdc -o discard=once,pri=10

ignores "once" the result is SWAP_FLAG_DISCARD; strace:

Old version:

  swapon("/dev/sdc", SWAP_FLAG_PREFER|SWAP_FLAG_DISCARD|10) = 0

Fixed version:

  swapon("/dev/sdc", SWAP_FLAG_PREFER|SWAP_FLAG_DISCARD|SWAP_FLAG_DISCARD_ONCE|10) = 0

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/swapon.c