Hi,
Please apply this patch to fstrim applet

Thanks.

--- busybox/util-linux/fstrim.c.orig	2013-11-10 11:33:33.966789413 +0100
+++ busybox/util-linux/fstrim.c	2013-11-10 12:46:23.045660354 +0100
@@ -60,7 +60,7 @@
 int fstrim_main(int argc UNUSED_PARAM, char **argv)
 {
 	struct fstrim_range range;
-	char *arg_o, *arg_l, *arg_m, *bd;
+	char *arg_o, *arg_l, *arg_m;
 	unsigned opts;
 	int fd;

@@ -83,6 +83,7 @@

 	opt_complementary = "=1"; /* exactly one non-option arg: the mountpoint */
 	opts = getopt32(argv, "o:l:m:v", &arg_o, &arg_l, &arg_m);
+	argv += optind;

 	memset(&range, 0, sizeof(range));
 	range.len = ULLONG_MAX;
@@ -94,15 +95,17 @@
 	if (opts & OPT_m)
 		range.minlen = xatoull_sfx(arg_m, fstrim_sfx);

-	bd = find_block_device(*(argv += optind));
-	if (bd) {
-		fd = xopen_nonblocking(bd);
+	/* here find_block_device() is only used to check
+	 * if *argv is a valid mount point.
+	 */
+	if (find_block_device(*argv)) {
+		fd = xopen_nonblocking(*argv);
 		xioctl(fd, FITRIM, &range);
 		if (ENABLE_FEATURE_CLEAN_UP)
 			close(fd);

 		if (opts & OPT_v)
-			printf("%s: %llu bytes were trimmed\n", bd, range.len);
+			printf("%s: %llu bytes were trimmed\n", *argv, range.len);
 		return EXIT_SUCCESS;
 	}
 	return EXIT_FAILURE;
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to