char *dup = buffer;
struct parse_line_conf *plc = data;
+ if (!plc->conf)
+ return syserror_set(-EINVAL, "Missing config");
+
/* If there are newlines in the config file we should keep them. */
empty_line = lxc_is_line_empty(dup);
if (empty_line)
char *dup = buffer;
char *dot, *key, *line, *value;
+ if (is_empty_string(buffer))
+ return log_error_errno(NULL, EINVAL, "Empty configuration line");
+
linep = line = strdup(dup);
if (!line)
return NULL;
int lxc_config_read(const char *file, struct lxc_conf *conf, bool from_include)
{
- struct parse_line_conf c;
+ struct parse_line_conf plc;
+
+ if (!conf)
+ return syserror_set(-EINVAL, "Missing config");
- c.conf = conf;
- c.from_include = from_include;
+ plc.conf = conf;
+ plc.from_include = from_include;
/* Catch only the top level config file name in the structure. */
if (!conf->rcfile)
conf->rcfile = strdup(file);
- return lxc_file_for_each_line_mmap(file, parse_line, &c);
+ return lxc_file_for_each_line_mmap(file, parse_line, &plc);
}
int lxc_config_define_add(struct lxc_list *defines, char *arg)