[PATCH 5/5] btrfs-progs: btrfs-crc: make argc check more strict

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

 



Signed-off-by: Satoru Takeuchi <takeuchi_satoru@xxxxxxxxxxxxxx>
---
 btrfs-crc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/btrfs-crc.c b/btrfs-crc.c
index c2b5f00..d433ff3 100644
--- a/btrfs-crc.c
+++ b/btrfs-crc.c
@@ -69,12 +69,14 @@ int main(int argc, char **argv)
 	str = argv[optind];

 	if (!loop) {
-		if (check_argc_min(argc - optind, 1))
+		if (check_argc_exact(argc - optind, 1))
 			print_usage(255);

 		printf("%12u - %s\n", crc32c(~1, str, strlen(str)), str);
 		return 0;
 	}
+	if (check_argc_exact(argc - optind, 0))
+		print_usage(255);

 	buf = malloc(length);
 	if (!buf)
--
2.5.5
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" 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 NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux