mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
swapon(8): adapt to the new swapoff(2) interface
also fix test sys/audit/administrative.c. Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33343
This commit is contained in:
parent
9f0fea5d03
commit
b49b6e0f95
|
@ -789,18 +789,12 @@ swapon_trim(const char *name)
|
||||||
static const char *
|
static const char *
|
||||||
swap_on_off_sfile(const char *name, int doingall)
|
swap_on_off_sfile(const char *name, int doingall)
|
||||||
{
|
{
|
||||||
struct swapoff_new_args sa;
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
if (which_prog == SWAPON)
|
if (which_prog == SWAPON)
|
||||||
error = Eflag ? swapon_trim(name) : swapon(name);
|
error = Eflag ? swapon_trim(name) : swapon(name);
|
||||||
else { /* SWAPOFF */
|
else /* SWAPOFF */
|
||||||
bzero(&sa, sizeof(sa));
|
error = swapoff(name, fflag ? SWAPOFF_FORCE : 0);
|
||||||
sa.name = name;
|
|
||||||
if (fflag)
|
|
||||||
sa.flags |= SWAPOFF_FORCE;
|
|
||||||
error = swapoff((const char *)&sa);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error == -1) {
|
if (error == -1) {
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
|
|
|
@ -1605,7 +1605,7 @@ ATF_TC_BODY(swapoff_failure, tc)
|
||||||
|
|
||||||
FILE *pipefd = setup(fds, auclass);
|
FILE *pipefd = setup(fds, auclass);
|
||||||
/* Failure reason: Block device required */
|
/* Failure reason: Block device required */
|
||||||
ATF_REQUIRE_EQ(-1, swapoff(path));
|
ATF_REQUIRE_EQ(-1, swapoff(path, 0));
|
||||||
check_audit(fds, adregex, pipefd);
|
check_audit(fds, adregex, pipefd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue