diff options
author | Karel Zak | 2009-10-13 14:22:33 +0200 |
---|---|---|
committer | Karel Zak | 2009-10-13 14:22:33 +0200 |
commit | 01373d74ef13014262d599cd9c26c1ec724a2204 (patch) | |
tree | ceba09a2f28d6bfe71ccffdcdd9d831c5a5d8f3f | |
parent | swapon: handle <=linux-2.6.19 bug in /proc/swaps (diff) | |
download | kernel-qcow2-util-linux-01373d74ef13014262d599cd9c26c1ec724a2204.tar.gz kernel-qcow2-util-linux-01373d74ef13014262d599cd9c26c1ec724a2204.tar.xz kernel-qcow2-util-linux-01373d74ef13014262d599cd9c26c1ec724a2204.zip |
swapon: more robust progname probing
Currently, the 'swapoff' is the default behavior. It means that if you
have a libtool wrapper script in your build directory the executed binary
name is 'lt-swapon' and then "swapon -a" is interpreted as "swapoff -a".
Any random argv[0] should not be interpreted as "swapoff".
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | mount/swapon.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mount/swapon.c b/mount/swapon.c index d89c6a965..a66d59d6d 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -791,6 +791,9 @@ main(int argc, char *argv[]) { if (streq(progname, "swapon")) return main_swapon(argc, argv); - else + else if (streq(progname, "swapoff")) return main_swapoff(argc, argv); + + errx(EXIT_FAILURE, _("'%s' is unsupported program name " + "(must be 'swapon' or 'swapoff')."), progname); } |