From 2a06d041bb9bd9162ef46eec228b84975dbe8404 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 8 Aug 2017 20:35:43 +0200 Subject: [PATCH] cgfsng: do not use uninitialized variable Signed-off-by: Christian Brauner --- src/lxc/cgroups/cgfsng.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 5e131683f..f1cb1de61 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -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; }