Re: [PATCH 05/16] Shorten permission checking to ensure we can actually write our initramfs.

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

 



On Sat, Aug 14, 2010 at 2:23 PM, Victor Lowther
<victor.lowther@xxxxxxxxx> wrote:
> These tests can be combined into an if... elif... elif... statement, and
> that makes it clear they are all part of the same test.
>
> ---
>  dracut |   12 ++++--------
>  1 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/dracut b/dracut
> index 33d802a..184b0c1 100755
> --- a/dracut
> +++ b/dracut
> @@ -210,18 +210,14 @@ if [[ -f $outfile && ! $force ]]; then
>     exit 1
>  fi
>
> -outdir=$(dirname "$outfile")
> -if ! [[ -d "$outdir" ]]; then
> +outdir=${outfile%/*}
> +if [[ ! -d "$outdir" ]]; then
>     echo "Can't write $outfile: Directory $outdir does not exist."
>     exit 1
> -fi
> -
> -if ! [[ -w "$outdir" ]]; then
> +elif [[ ! -w "$outdir" ]]; then
>     echo "No permission to write $outdir."
>     exit 1
> -fi
> -
> -if [[ -f "$outfile" ]] &&  ! [[ -w "$outfile" ]]; then
> +elif [[ ! -w "$outfile" ]]; then

Stupid thinko.  [[ -f $outfile && ! -w $outfile ]], obviously.

>     echo "No permission to write $outfile."
>     exit 1
>  fi
> --
> 1.7.2.1
>
>
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux