Page MenuHomeFreeBSD

D21006.id59959.diff
No OneTemporary

D21006.id59959.diff

Index: sbin/swapon/swapon.c
===================================================================
--- sbin/swapon/swapon.c
+++ sbin/swapon/swapon.c
@@ -739,12 +739,12 @@
return (WEXITSTATUS(status));
}
-static void
-swap_trim(const char *name)
+static int
+swapon_trim(const char *name)
{
struct stat sb;
off_t ioarg[2], sz;
- int fd;
+ int error, fd;
fd = open(name, O_WRONLY);
if (fd < 0)
@@ -762,7 +762,9 @@
ioarg[1] = sz;
if (ioctl(fd, DIOCGDELETE, ioarg) != 0)
warn("ioctl(DIOCGDELETE)");
+ error = swapon(name);
close(fd);
+ return (error);
}
static const char *
@@ -770,11 +772,9 @@
{
int error;
- if (which_prog == SWAPON) {
- if (Eflag)
- swap_trim(name);
- error = swapon(name);
- } else /* SWAPOFF */
+ if (which_prog == SWAPON)
+ error = Eflags ? swapon_trim(name) : swapon(name);
+ else /* SWAPOFF */
error = swapoff(name);
if (error == -1) {

File Metadata

Mime Type
text/plain
Expires
Mon, May 18, 4:42 PM (58 m, 3 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33257342
Default Alt Text
D21006.id59959.diff (900 B)

Event Timeline