cgfsng: do not use uninitialized variable

parent 28cfa8fc
...@@ -1904,10 +1904,12 @@ static int cgfsng_set(const char *filename, const char *value, const char *name, ...@@ -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) static int convert_devpath(const char *invalue, char *dest)
{ {
char *p, *path, *mode, type; int n_parts;
char *p, *path, type;
struct stat sb; struct stat sb;
unsigned long minor, major; unsigned long minor, major;
int n_parts, ret = -EINVAL; int ret = -EINVAL;
char *mode = NULL;
path = must_copy_string(invalue); path = must_copy_string(invalue);
...@@ -1956,8 +1958,8 @@ static int convert_devpath(const char *invalue, char *dest) ...@@ -1956,8 +1958,8 @@ static int convert_devpath(const char *invalue, char *dest)
minor = MINOR(sb.st_rdev); minor = MINOR(sb.st_rdev);
ret = snprintf(dest, 50, "%c %lu:%lu %s", type, major, minor, mode); ret = snprintf(dest, 50, "%c %lu:%lu %s", type, major, minor, mode);
if (ret < 0 || ret >= 50) { if (ret < 0 || ret >= 50) {
ERROR("Error on configuration value \"%c %lu:%lu %s\" (max 50 chars)", ERROR("Error on configuration value \"%c %lu:%lu %s\" (max 50 "
type, major, minor, mode); "chars)", type, major, minor, mode);
ret = -ENAMETOOLONG; ret = -ENAMETOOLONG;
goto out; goto out;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment