[PATCH 2/3] nilfs-clean: do not change min_reclaimable_blocks_unit in erroneous case

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

 



nilfs_clean_parse_min_reclaimable() function changes value of
min_reclaimable_blocks_unit even if a given percentage value is
invalid.  Although it doesn't cause any actual problems since its only
caller, nilfs_clean_parse_options(), will immediately abort the
program when nilfs_clean_parse_min_reclaimable() returned an error
status code (-1), it is not sane for
nilfs_clean_parse_min_reclaimable() function itself.

Cc: Andreas Rohner <andreas.rohner@xxxxxxx>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxxxxxx>
---
 sbin/nilfs-clean/nilfs-clean.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/nilfs-clean/nilfs-clean.c b/sbin/nilfs-clean/nilfs-clean.c
index 62130c4..ab2180a 100644
--- a/sbin/nilfs-clean/nilfs-clean.c
+++ b/sbin/nilfs-clean/nilfs-clean.c
@@ -407,12 +407,12 @@ static int nilfs_clean_parse_min_reclaimable(const char *arg)
 	}
 
 	if (endptr[0] == '%') {
-		min_reclaimable_blocks_unit = NILFS_CLEANER_ARG_UNIT_PERCENT;
 		if (blocks > 100) {
 			myprintf(_("Error: percent value can't be > 100: %s\n"),
 					arg);
 			return -1;
 		}
+		min_reclaimable_blocks_unit = NILFS_CLEANER_ARG_UNIT_PERCENT;
 	} else {
 		min_reclaimable_blocks_unit = NILFS_CLEANER_ARG_UNIT_NONE;
 	}
-- 
1.7.9.4

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




[Index of Archives]     [Linux Filesystem Development]     [Linux BTRFS]     [Linux CIFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux