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

Shaun Jackman sjackman at gmail.com
Sat Jul 8 17:35:42 UTC 2006


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) {
-------------- 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