The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2682

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 576fb366f86f5ae33f1893026e948023476586ae Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Mon, 8 Oct 2018 22:49:57 +0200
Subject: [PATCH 1/2] parse: do not mask failed parse

Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 src/lxc/parse.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lxc/parse.c b/src/lxc/parse.c
index bab842a21..05764b964 100644
--- a/src/lxc/parse.c
+++ b/src/lxc/parse.c
@@ -111,9 +111,11 @@ int lxc_file_for_each_line_mmap(const char *file, 
lxc_file_cb callback, void *da
        }
 
 on_error:
-       ret = lxc_strmunmap(buf, st.st_size);
-       if (ret < 0)
+       if (lxc_strmunmap(buf, st.st_size) < 0) {
                SYSERROR("Failed to unmap config file \"%s\"", file);
+               if (ret == 0)
+                       ret = -1;
+       }
 
        saved_errno = errno;
        close(fd);

From 646e6c8b465fafde9447c87ca967da9e82f50f7b Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Mon, 8 Oct 2018 22:53:16 +0200
Subject: [PATCH 2/2] test: test invalid config keys

Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 src/tests/get_item.c          | 6 ++++++
 src/tests/parse_config_file.c | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/src/tests/get_item.c b/src/tests/get_item.c
index f4c8d9228..f2757c29d 100644
--- a/src/tests/get_item.c
+++ b/src/tests/get_item.c
@@ -600,6 +600,12 @@ int main(int argc, char *argv[])
                goto out;
        }
 
+       if (c->set_config_item(c, "lxc.notaconfigkey", "invalid")) {
+               fprintf(stderr, "%d: Managed to set \"lxc.notaconfigkey\"\n", 
__LINE__);
+               goto out;
+       }
+
+
        printf("All get_item tests passed\n");
        fret = EXIT_SUCCESS;
 
diff --git a/src/tests/parse_config_file.c b/src/tests/parse_config_file.c
index b13982d30..b8b71c8e1 100644
--- a/src/tests/parse_config_file.c
+++ b/src/tests/parse_config_file.c
@@ -778,6 +778,11 @@ int main(int argc, char *argv[])
                goto non_test_error;
        }
 
+       if (c->set_config_item(c, "lxc.notaconfigkey", "invalid")) {
+               lxc_error("%s\n", "Managed to set to set invalid config item 
\"lxc.notaconfigkey\" to \"invalid\"");
+               return -1;
+       }
+
        fret = EXIT_SUCCESS;
 
 non_test_error:
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to