git: ed21083462a6 - stable/13 - swapon(8): adapt to the new swapoff(2) interface
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 Dec 2021 00:38:12 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ed21083462a66d6d3dd4daa8515333ca42a0290d commit ed21083462a66d6d3dd4daa8515333ca42a0290d Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-12-08 21:05:49 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-12-20 00:29:11 +0000 swapon(8): adapt to the new swapoff(2) interface (cherry picked from commit b49b6e0f95c89f8dcb5898424c360b46019254b4) --- sbin/swapon/swapon.c | 10 ++-------- tests/sys/audit/administrative.c | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c index d644d99e7913..4daa6e8b17ee 100644 --- a/sbin/swapon/swapon.c +++ b/sbin/swapon/swapon.c @@ -789,18 +789,12 @@ swapon_trim(const char *name) static const char * swap_on_off_sfile(const char *name, int doingall) { - struct swapoff_new_args sa; int error; if (which_prog == SWAPON) error = Eflag ? swapon_trim(name) : swapon(name); - else { /* SWAPOFF */ - bzero(&sa, sizeof(sa)); - sa.name = name; - if (fflag) - sa.flags |= SWAPOFF_FORCE; - error = swapoff((const char *)&sa); - } + else /* SWAPOFF */ + error = swapoff(name, fflag ? SWAPOFF_FORCE : 0); if (error == -1) { switch (errno) { diff --git a/tests/sys/audit/administrative.c b/tests/sys/audit/administrative.c index d75f6147cdf4..159e7c14e031 100644 --- a/tests/sys/audit/administrative.c +++ b/tests/sys/audit/administrative.c @@ -1605,7 +1605,7 @@ ATF_TC_BODY(swapoff_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: Block device required */ - ATF_REQUIRE_EQ(-1, swapoff(path)); + ATF_REQUIRE_EQ(-1, swapoff(path, 0)); check_audit(fds, adregex, pipefd); }