make swapctl exit with non-zero if -A and nothing swapped on
This commit is contained in:
parent
021fdb646a
commit
2fe3f46005
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: swapctl.8,v 1.12 1998/01/26 06:58:01 ross Exp $
|
||||
.\" $NetBSD: swapctl.8,v 1.13 1998/02/10 03:14:32 mrg Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997 Matthew R. Green
|
||||
.\" All rights reserved.
|
||||
@ -87,7 +87,9 @@ This option causes
|
||||
to read the
|
||||
.Pa /etc/fstab
|
||||
file for devices and files with a ``sw'' type, and adds all these entries
|
||||
as swap devices.
|
||||
as swap devices. If no swap devices are configured,
|
||||
.Nm
|
||||
will exit with an error code.
|
||||
.It Fl a
|
||||
The
|
||||
.Fl a
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: swapctl.c,v 1.7 1997/10/10 05:39:53 mrg Exp $ */
|
||||
/* $NetBSD: swapctl.c,v 1.8 1998/02/10 03:14:33 mrg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1997 Matthew R. Green
|
||||
@ -348,6 +348,7 @@ do_fstab()
|
||||
long priority;
|
||||
struct stat st;
|
||||
int isblk;
|
||||
int gotone = 0;
|
||||
|
||||
#define PRIORITYEQ "priority="
|
||||
#define NFSMNTPT "nfsmntpt="
|
||||
@ -423,13 +424,17 @@ do_fstab()
|
||||
|
||||
if (swapctl(SWAP_ON, spec, (int)priority) < 0)
|
||||
warn("%s", spec);
|
||||
else
|
||||
else {
|
||||
gotone = 1;
|
||||
printf("%s: adding %s as swap device at priority %d\n",
|
||||
__progname, fp->fs_spec, (int)priority);
|
||||
}
|
||||
|
||||
if (spec != fp->fs_spec)
|
||||
free(spec);
|
||||
}
|
||||
if (gotone == 0)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user