diff mbox

fsck.btrfs: Fix bashism and bad getopts processing

Message ID 1432212655-6238-1-git-send-email-dimitri.j.ledkov@intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Dimitri John Ledkov May 21, 2015, 12:50 p.m. UTC
First fix == bashism, as that is not accepted by e.g. Debian/Ubuntu
dash.

Secondly shift OPTIND, such that last parameter is checked to exist.

Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
---
 fsck.btrfs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Sterba May 21, 2015, 2:40 p.m. UTC | #1
On Thu, May 21, 2015 at 01:50:55PM +0100, Dimitri John Ledkov wrote:
> First fix == bashism, as that is not accepted by e.g. Debian/Ubuntu
> dash.
> 
> Secondly shift OPTIND, such that last parameter is checked to exist.
> 
> Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba May 25, 2015, 12:28 p.m. UTC | #2
On Thu, May 21, 2015 at 01:50:55PM +0100, Dimitri John Ledkov wrote:
> First fix == bashism, as that is not accepted by e.g. Debian/Ubuntu
> dash.
> 
> Secondly shift OPTIND, such that last parameter is checked to exist.
> 
> Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
> ---
>  fsck.btrfs | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fsck.btrfs b/fsck.btrfs
> index f056a7f..20b070a 100755
> --- a/fsck.btrfs
> +++ b/fsck.btrfs
> @@ -26,12 +26,13 @@ do
>  	a|A|p|y)	AUTO=true;;
>  	esac
>  done
> +shift $(($OPTIND -1))

BTW, this line is missing in the fsck.xfs stub as well, you may want to
send the patch to xfsprogs.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fsck.btrfs b/fsck.btrfs
index f056a7f..20b070a 100755
--- a/fsck.btrfs
+++ b/fsck.btrfs
@@ -26,12 +26,13 @@  do
 	a|A|p|y)	AUTO=true;;
 	esac
 done
+shift $(($OPTIND -1))
 eval DEV=\${$#}
 if [ ! -e $DEV ]; then
 	echo "$0: $DEV does not exist"
 	exit 8
 fi
-if [ "$AUTO" == "false" ]; then
+if ! $AUTO; then
 	echo "If you wish to check the consistency of a BTRFS filesystem or"
 	echo "repair a damaged filesystem, see btrfs(8) subcommand 'check'."
 fi