]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
change log macro of error case from lxc_ambient_caps_up/down
author2xsec <dh48.jeong@samsung.com>
Sun, 22 Jul 2018 12:03:46 +0000 (21:03 +0900)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 10 Dec 2018 14:22:24 +0000 (15:22 +0100)
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
src/lxc/caps.c
src/lxc/start.c

index 6665af217609d02e9ec336ed62c127a598df318c..a697856ac5bd85df0b29a81d90fd2031bc9cfb13 100644 (file)
@@ -114,7 +114,6 @@ int lxc_caps_up(void)
        }
 
        for (cap = 0; cap <= CAP_LAST_CAP; cap++) {
-
                cap_flag_value_t flag;
 
                ret = cap_get_flag(caps, cap, CAP_PERMITTED, &flag);
@@ -203,8 +202,10 @@ int lxc_ambient_caps_up(void)
        }
 
        cap_names = cap_to_text(caps, NULL);
-       if (!cap_names)
+       if (!cap_names) {
+               SYSWARN("Failed to convert capabilities %d", cap);
                goto out;
+       }
 
        TRACE("Raised %s in inheritable and ambient capability set", cap_names);
 
@@ -317,6 +318,7 @@ static int _real_caps_last_cap(void)
                if ((n = read(fd, buf, 31)) >= 0) {
                        buf[n] = '\0';
                        errno = 0;
+
                        result = strtol(buf, &ptr, 10);
                        if (!ptr || (*ptr != '\0' && *ptr != '\n') || errno != 0)
                                result = -1;
@@ -329,7 +331,10 @@ static int _real_caps_last_cap(void)
        * each capability indiviually from the kernel */
        if (result < 0) {
                int cap = 0;
-               while (prctl(PR_CAPBSET_READ, cap) >= 0) cap++;
+
+               while (prctl(PR_CAPBSET_READ, cap) >= 0)
+                       cap++;
+
                result = cap - 1;
        }
 
@@ -339,7 +344,9 @@ static int _real_caps_last_cap(void)
 int lxc_caps_last_cap(void)
 {
        static int last_cap = -1;
-       if (last_cap < 0) last_cap = _real_caps_last_cap();
+
+       if (last_cap < 0)
+               last_cap = _real_caps_last_cap();
 
        return last_cap;
 }
index 209904c01fae3d0840040204132cdf2022411602..33585df7d33c0afe0a667dbf8c920e90104a7afd 100644 (file)
@@ -1091,7 +1091,7 @@ static int do_start(void *data)
 
        ret = lxc_ambient_caps_up();
        if (ret < 0) {
-               SYSERROR("Failed to raise ambient capabilities");
+               ERROR("Failed to raise ambient capabilities");
                goto out_warn_father;
        }
 
@@ -1359,7 +1359,7 @@ static int do_start(void *data)
 
        ret = lxc_ambient_caps_down();
        if (ret < 0) {
-               SYSERROR("Failed to clear ambient capabilities");
+               ERROR("Failed to clear ambient capabilities");
                goto out_warn_father;
        }