[lxc-devel] [PATCH 2/2] Add -n differentiation to lxc-netstat

Serge Hallyn serge.hallyn at ubuntu.com
Thu Jun 27 13:04:57 UTC 2013


Quoting Andrew Gilbert (andrewg800 at gmail.com):
> lxc-netstat now only processes an -n argument if it has not previously
> received a value for $name from --name or -n. If it _has_ received such
> a value, it stops processing arguments and leaves the -n for netstat.
> This does not apply to the use of --name after a name has been provided
> by --name or -n; the current behaviour continues. The new behaviour
> makes
> 	netstat -n <container> -n -a
> behave like
> 	netstat -n <container> -a -n
> which already will act as though there is '--' between '<container>' and
> '-a' (see line 91 of lxc-netstat.in).
> 
> Signed-off-by: Andrew Gilbert <andrewg800 at gmail.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

thanks, pushing.

> ---
>   src/lxc/lxc-netstat.in | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/lxc-netstat.in b/src/lxc/lxc-netstat.in
> index 229c214..4a239d9 100644
> --- a/src/lxc/lxc-netstat.in
> +++ b/src/lxc/lxc-netstat.in
> @@ -66,12 +66,23 @@ get_parent_cgroup()
>   }
>    exec=""
> +name=""
>    while true; do
>       case $1 in
>           -h|--help)
>               help; exit 1;;
> -        -n|--name)
> +        -n)
> +            # If we already have a value for $name, treat -n as being an
> +            # argument for netstat
> +            if [ -n "$name" ]
> +            then
> +                break
> +            else
> +                name="$2"; shift 2;
> +            fi
> +            ;;
> +        --name)
>               name=$2; shift 2;;
>           --exec)
>               exec="exec"; shift;;
> -- 
> 1.8.1.2
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
> 
> Build for Windows Store.
> 
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list