summaryrefslogtreecommitdiff
path: root/src/md5sum.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/md5sum.c')
-rw-r--r--src/md5sum.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/md5sum.c b/src/md5sum.c
index 39132e340..3ed1b65e7 100644
--- a/src/md5sum.c
+++ b/src/md5sum.c
@@ -864,12 +864,13 @@ main (int argc, char **argv)
if (!O_BINARY && binary < 0)
binary = 0;
+ char **operand_lim = argv + argc;
if (optind == argc)
- argv[argc++] = bad_cast ("-");
+ *operand_lim++ = bad_cast ("-");
- for (; optind < argc; ++optind)
+ for (char **operandp = argv + optind; operandp < operand_lim; operandp++)
{
- char *file = argv[optind];
+ char *file = *operandp;
if (do_check)
ok &= digest_check (file);