Commit a8b1ac78 by Tycho Andersen

add some idmap parsing error messages

otherwise, we just get a return value of false from setting config failure, with no indication as to what actually failed in the log. Signed-off-by: 's avatarTycho Andersen <tycho@tycho.ws>
parent 9531b90a
...@@ -1665,8 +1665,10 @@ static int set_config_idmaps(const char *key, const char *value, ...@@ -1665,8 +1665,10 @@ static int set_config_idmaps(const char *key, const char *value,
memset(idmap, 0, sizeof(*idmap)); memset(idmap, 0, sizeof(*idmap));
ret = parse_idmaps(value, &type, &nsid, &hostid, &range); ret = parse_idmaps(value, &type, &nsid, &hostid, &range);
if (ret < 0) if (ret < 0) {
ERROR("error parsing id maps");
goto on_error; goto on_error;
}
INFO("Read uid map: type %c nsid %lu hostid %lu range %lu", type, nsid, hostid, range); INFO("Read uid map: type %c nsid %lu hostid %lu range %lu", type, nsid, hostid, range);
if (type == 'u') if (type == 'u')
......
...@@ -62,8 +62,11 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid, ...@@ -62,8 +62,11 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid,
goto on_error; goto on_error;
/* Validate type. */ /* Validate type. */
if (*slide != 'u' && *slide != 'g') if (*slide != 'u' && *slide != 'g') {
ERROR("invalid mapping type: %c", *slide);
goto on_error; goto on_error;
}
/* Assign type. */ /* Assign type. */
tmp_type = *slide; tmp_type = *slide;
...@@ -88,8 +91,10 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid, ...@@ -88,8 +91,10 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid,
*slide = '\0'; *slide = '\0';
/* Parse nsuid. */ /* Parse nsuid. */
if (lxc_safe_ulong(window, &tmp_nsid) < 0) if (lxc_safe_ulong(window, &tmp_nsid) < 0) {
ERROR("couldn't parse nsuid: %s", window);
goto on_error; goto on_error;
}
/* Move beyond \0. */ /* Move beyond \0. */
slide++; slide++;
...@@ -112,8 +117,10 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid, ...@@ -112,8 +117,10 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid,
*slide = '\0'; *slide = '\0';
/* Parse hostid. */ /* Parse hostid. */
if (lxc_safe_ulong(window, &tmp_hostid) < 0) if (lxc_safe_ulong(window, &tmp_hostid) < 0) {
ERROR("couldn't parse hostid: %s", window);
goto on_error; goto on_error;
}
/* Move beyond \0. */ /* Move beyond \0. */
slide++; slide++;
...@@ -142,8 +149,10 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid, ...@@ -142,8 +149,10 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid,
*slide = '\0'; *slide = '\0';
/* Parse range. */ /* Parse range. */
if (lxc_safe_ulong(window, &tmp_range) < 0) if (lxc_safe_ulong(window, &tmp_range) < 0) {
ERROR("couldn't parse range: %s", window);
goto on_error; goto on_error;
}
*type = tmp_type; *type = tmp_type;
*nsid = tmp_nsid; *nsid = tmp_nsid;
......
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