/etc/fstab:
736f610b58fed843.b none swap sw 0 0
# swapctl -A
swapctl: 736f610b58fed843.b: No such file or directory
With patch below:
# swapctl -A
swapctl: adding 736f610b58fed843.b as swap device at priority 0
Plug a tiny mem leak while here. ok?
Index: swapctl.c
===================================================================
RCS file: /cvs/src/sbin/swapctl/swapctl.c,v
retrieving revision 1.17
diff -u -p -r1.17 swapctl.c
--- swapctl.c 26 Nov 2007 13:36:33 -0000 1.17
+++ swapctl.c 28 Dec 2010 20:33:47 -0000
@@ -395,9 +395,10 @@ do_fstab(void)
errx(1, "path too long");
if (system(cmd) != 0) {
warnx("%s: mount failed", fp->fs_spec);
+ free((char *)spec);
continue;
}
- } else {
+ } else if (spec[0] == '/') {
/*
* Determine blk-ness. Don't even consider a
* mountpoint outside /dev as a block device.
@@ -419,6 +420,13 @@ do_fstab(void)
if (!S_ISREG(st.st_mode) &&
!S_ISBLK(st.st_mode))
continue;
+ } else if (strlen(spec) > 0) {
+ /* Assume a DUID (block device). */
+ if (rejecttype == S_IFBLK)
+ continue;
+ } else {
+ warnx("empty mountpoint");
+ continue;
}
if (swapctl(SWAP_ON, spec, (int)priority) < 0) {