[PATCH] md5sum: Set optind to 1 if getopt is not called

Shaun Jackman sjackman at gmail.com
Mon Jul 17 22:56:39 UTC 2006


On 7/8/06, Shaun Jackman <sjackman at gmail.com> wrote:
> Well, there was bound to be at least one. Please apply.
>
> Cheers,
> Shaun
>
> 2006-07-08  Shaun Jackman  <sjackman at gmail.com>
>
>         * coreutils/md5_sha1_sum.c (hash_files): Set optind to 1 if getopt
>         is not called.
>
> --- coreutils/md5_sha1_sum.c    c5a2746a35b82fb4c06299b094dd22c951bb748b
> +++ coreutils/md5_sha1_sum.c    ea2784f5767284a648dcc5c0544a0b0eb4e22fbc
> @@ -98,6 +98,8 @@
>
>         if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK)
>                 flags = bb_getopt_ulflags(argc, argv, "scw");
> +       else
> +               optind = 1;
>
>         if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) {
>                 if (flags & FLAG_SILENT) {

Comments?

Cheers,
Shaun
-------------- next part --------------
2006-07-08  Shaun Jackman  <sjackman at gmail.com>

	* coreutils/md5_sha1_sum.c (hash_files): Set optind to 1 if getopt
	is not called.

--- coreutils/md5_sha1_sum.c	c5a2746a35b82fb4c06299b094dd22c951bb748b
+++ coreutils/md5_sha1_sum.c	ea2784f5767284a648dcc5c0544a0b0eb4e22fbc
@@ -98,6 +98,8 @@
 
 	if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK)
 		flags = bb_getopt_ulflags(argc, argv, "scw");
+	else
+		optind = 1;
 
 	if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && !(flags & FLAG_CHECK)) {
 		if (flags & FLAG_SILENT) {


More information about the busybox mailing list