Properly ignore "trim" failures in swapon(8).
authorDaniel Fojt <df@neosystem.org>
Thu, 11 Jun 2020 18:11:55 +0000 (20:11 +0200)
committerDaniel Fojt <df@neosystem.org>
Thu, 11 Jun 2020 18:54:20 +0000 (20:54 +0200)
When trying to "trim" a swap device that doesn't support this, just ignore
particular ioctl() failure and continue activating the swap. This actually
matches the behaviour described in swapon(8) manpage.

Issue: https://bugs.dragonflybsd.org/issues/3207

sbin/swapon/swapon.c

index 3c7fdd7..dee5c0e 100644 (file)
@@ -345,7 +345,6 @@ trim_volume(char * name)
             name, (intmax_t)ioarg[0], (intmax_t)ioarg[1]);
        if (ioctl(fd, DAIOCTRIM, ioarg) < 0) {
                printf("Device trim failed\n");
-               usage ();
        }
        close(fd);
 }