]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
add some idmap parsing error messages
authorTycho Andersen <tycho@tycho.ws>
Tue, 9 Jan 2018 00:07:50 +0000 (00:07 +0000)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 19 Jan 2018 13:40:05 +0000 (14:40 +0100)
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: Tycho Andersen <tycho@tycho.ws>
src/lxc/confile_utils.c

index 2156b759f9ea3656bacea4e28324251fb18795ee..d3ba574bed0c88cb6d428f0a32f43c959d464042 100644 (file)
@@ -59,8 +59,11 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid,
                goto on_error;
 
        /* Validate type. */
-       if (*slide != 'u' && *slide != 'g')
+       if (*slide != 'u' && *slide != 'g') {
+               ERROR("invalid mapping type: %c", *slide);
                goto on_error;
+       }
+
        /* Assign type. */
        tmp_type = *slide;
 
@@ -85,8 +88,10 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid,
        *slide = '\0';
 
        /* 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;
+       }
 
        /* Move beyond \0. */
        slide++;
@@ -109,8 +114,10 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid,
        *slide = '\0';
 
        /* 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;
+       }
 
        /* Move beyond \0. */
        slide++;
@@ -139,8 +146,10 @@ int parse_idmaps(const char *idmap, char *type, unsigned long *nsid,
        *slide = '\0';
 
        /* 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;
+       }
 
        *type = tmp_type;
        *nsid = tmp_nsid;