----- Original Message -----
> From: "Libo Chen" <libo.c...@huawei.com>
> To: varek...@redhat.com
> Cc: "dhaval giani" <dhaval.gi...@gmail.com>, jsafr...@redhat.com, 
> libcg-devel@lists.sourceforge.net,
> lize...@huawei.com, "h huangqiang" <h.huangqi...@huawei.com>, "wengmeiling 
> weng" <wengmeiling.w...@huawei.com>,
> "libo chen" <libo.c...@huawei.com>
> Sent: Tuesday, September 3, 2013 10:49:15 AM
> Subject: [PATCH v3 2/8] cgconfig: add err check
> 
> From: Libo Chen <clbchenlibo.c...@huawei.com>
> 
> cgroup still can be created even if giving invalid -d,-f,-s parameter.
> e.g.
>       cgconfigparser  -d 888 -l /etc/cgconfig.conf
>       "888" is invalid, but cgroup will be created.
> 
>       So we should exit when -d,-f or -s is invalid.
> 
> v3:
>  - add nonzero return value
>  - use error instead of ret
> Signed-off-by: Libo Chen <clbchenlibo.c...@huawei.com>
> ---
>  src/tools/cgconfig.c |   12 +++++++++---
>  1 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/src/tools/cgconfig.c b/src/tools/cgconfig.c
> index 6aeea0f..81d07c9 100644
> --- a/src/tools/cgconfig.c
> +++ b/src/tools/cgconfig.c
> @@ -121,15 +121,21 @@ int main(int argc, char *argv[])
>                       break;
>               case 'd':
>                       dirm_change = 1;
> -                     ret = parse_mode(optarg, &dir_mode, argv[0]);
> +                     error = parse_mode(optarg, &dir_mode, argv[0]);
> +                     if (error)
> +                             goto err;
Hello,
just one small change, there is no need to free default_group in these three 
cases. With this change it is ok for me.
>                       break;
>               case 'f':
>                       filem_change = 1;
> -                     ret = parse_mode(optarg, &file_mode, argv[0]);
> +                     error = parse_mode(optarg, &file_mode, argv[0]);
> +                     if (error)
> +                             goto err;
>                       break;
>               case 's':
>                       filem_change = 1;
> -                     ret = parse_mode(optarg, &tasks_mode, argv[0]);
> +                     error = parse_mode(optarg, &tasks_mode, argv[0]);
> +                     if (error)
> +                             goto err;
>                       break;
>               default:
>                       usage(argv[0]);
> --
> 1.7.1
> 
> 
> 

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to