diff options
author | David Schultz <das@FreeBSD.org> | 2003-02-24 08:51:31 +0000 |
---|---|---|
committer | David Schultz <das@FreeBSD.org> | 2003-02-24 08:51:31 +0000 |
commit | 4937798d565eab9bf594d51b141f3b2fa9b3d4b0 (patch) | |
tree | d318d0a4d20bbbb215389c6d5d3dad61c5062550 | |
parent | 9cdb2d4d9d590a2a24bf7a304ca67f65daad98a6 (diff) | |
download | src-4937798d565eab9bf594d51b141f3b2fa9b3d4b0.tar.gz src-4937798d565eab9bf594d51b141f3b2fa9b3d4b0.zip |
Notes
-rw-r--r-- | sbin/swapon/swapon.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c index 82af8be893f5..ae88c8ca9f62 100644 --- a/sbin/swapon/swapon.c +++ b/sbin/swapon/swapon.c @@ -140,7 +140,7 @@ main(int argc, char **argv) continue; if (strstr(fsp->fs_mntops, "noauto")) continue; - if (swap_on_off(fsp->fs_spec, 0)) { + if (swap_on_off(fsp->fs_spec, 1)) { stat = 1; } else { printf("%s: %sing %s as swap device\n", @@ -170,14 +170,20 @@ main(int argc, char **argv) } static int -swap_on_off(char *name, int ignoreebusy) +swap_on_off(char *name, int doingall) { if ((which_prog == SWAPOFF ? swapoff(name) : swapon(name)) == -1) { switch (errno) { case EBUSY: - if (!ignoreebusy) + if (!doingall) warnx("%s: device already in use", name); break; + case EINVAL: + if (which_prog == SWAPON) + warnx("%s: NSWAPDEV limit reached", name); + else if (!doingall) + warn("%s", name); + break; default: warn("%s", name); break; |