]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Avoid hardcoded string length 2804/head
authorRachid Koucha <47061324+Rachid-Koucha@users.noreply.github.com>
Sun, 27 Jan 2019 00:07:38 +0000 (01:07 +0100)
committerGitHub <noreply@github.com>
Sun, 27 Jan 2019 00:07:38 +0000 (01:07 +0100)
Use strlen() on "state" variable instead of harcoded
value 6.

Signed-off-by: Rachid Koucha <rachid.koucha@gmail.com>
src/lxc/freezer.c

index e9755d1baf633cff2ed945d3ade3522a21d304cc..ad9052c7bc72dd4b95e6482de10fd147c360811c 100644 (file)
@@ -52,10 +52,11 @@ static int do_freeze_thaw(bool freeze, struct lxc_conf *conf, const char *name,
        char v[100];
        struct cgroup_ops *cgroup_ops;
         const char *state;
-       size_t state_len = 6;
+       size_t state_len;
        lxc_state_t new_state = freeze ? FROZEN : THAWED;
 
         state = lxc_state2str(new_state);
+       state_len = strlen(state);
 
        cgroup_ops = cgroup_init(conf);
        if (!cgroup_ops)