]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
cgconfig: fix the excursive processing
authorLibo Chen <libo.chen@huawei.com>
Tue, 10 Sep 2013 06:18:32 +0000 (08:18 +0200)
committerLibo Chen <libo.chen@huawei.com>
Tue, 10 Sep 2013 06:18:32 +0000 (08:18 +0200)
error and ret should be unified

v4:
 - use error for cgroup_string_list_add_item
   goto err lable instead of exit

Signed-off-by: Libo Chen <clbchenlibo.chen@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
src/tools/cgconfig.c

index 81d07c991a9f100da2139122d005d276ccf17909..900c2354f1f78d2eb46e53410b123af12d7d3f4e 100644 (file)
@@ -98,11 +98,11 @@ int main(int argc, char *argv[])
                        usage(argv[0]);
                        break;
                case 'l':
-                       ret = cgroup_string_list_add_item(&cfg_files, optarg);
-                       if (ret) {
+                       error = cgroup_string_list_add_item(&cfg_files, optarg);
+                       if (error) {
                                fprintf(stderr, "%s: cannot add file to list,"\
                                                " out of memory?\n", argv[0]);
-                               exit(1);
+                               goto err;
                        }
                        break;
                case 'L':
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
        error = cgroup_set_uid_gid(default_group, tuid, tgid, auid, agid);
        if (error) {
                fprintf(stderr, "%s: cannot set default UID and GID: %s\n",
-                               argv[0], cgroup_strerror(ret));
+                               argv[0], cgroup_strerror(error));
                goto err;
        }
 
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
        error = cgroup_config_set_default(default_group);
        if (error) {
                fprintf(stderr, "%s: cannot set config parser defaults: %s\n",
-                               argv[0], cgroup_strerror(ret));
+                               argv[0], cgroup_strerror(error));
                goto err;
        }