[PATCH] fstrim: Return EXIT_FAILURE when FTRIM ioctl fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



commit 36c370cbf1481aa8724dff8b7b7fec4a8ba9930b add fstrim_filesystem
that return -1 or 1 depending on the FTRIM ioctl failures.
Without this change, main() returns -1 if the fstrim_filesystem()
returns -1.
Returns EXIT_FAILURE in both cases.

Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx>
---
 sys-utils/fstrim.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c
index ce52063e1..66b126b9f 100644
--- a/sys-utils/fstrim.c
+++ b/sys-utils/fstrim.c
@@ -339,10 +339,10 @@ int main(int argc, char **argv)
 		rc = fstrim_all(&range, verbose);
 	else {
 		rc = fstrim_filesystem(path, &range, verbose);
-		if (rc == 1) {
+		if (rc == 1)
 			warnx(_("%s: the discard operation is not supported"), path);
+		if (rc != 0)
 			rc = EXIT_FAILURE;
-		}
 	}
 
 	return rc;
-- 
2.17.0.484.g0c8726318c-goog

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux