]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgfsng: do not use uninitialized variable
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 8 Aug 2017 18:35:43 +0000 (20:35 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 10 Aug 2017 18:30:06 +0000 (20:30 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c

index 5e131683f0f866114974221eb83bbc9955dd901d..f1cb1de6131141d2b0bb6ee8f07d033cbaf2d2ac 100644 (file)
@@ -1904,10 +1904,12 @@ static int cgfsng_set(const char *filename, const char *value, const char *name,
  */
 static int convert_devpath(const char *invalue, char *dest)
 {
-       char *p, *path, *mode, type;
+       int n_parts;
+       char *p, *path, type;
        struct stat sb;
        unsigned long minor, major;
-       int n_parts, ret = -EINVAL;
+       int ret = -EINVAL;
+       char *mode = NULL;
 
        path = must_copy_string(invalue);
 
@@ -1956,8 +1958,8 @@ static int convert_devpath(const char *invalue, char *dest)
        minor = MINOR(sb.st_rdev);
        ret = snprintf(dest, 50, "%c %lu:%lu %s", type, major, minor, mode);
        if (ret < 0 || ret >= 50) {
-               ERROR("Error on configuration value \"%c %lu:%lu %s\" (max 50 chars)",
-                               type, major, minor, mode);
+               ERROR("Error on configuration value \"%c %lu:%lu %s\" (max 50 "
+                     "chars)", type, major, minor, mode);
                ret = -ENAMETOOLONG;
                goto out;
        }