From 9b5724cd5808f45fd77edd6189a10f199d8f0153 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 22 Aug 2018 00:04:19 +0200 Subject: [PATCH 1/2] autotools: check if compiler is new enough We line up with the Linux kernel and won't support any compiler under 4.6. Additionally, we also require at least gnu99 so this is due anyway. Signed-off-by: Christian Brauner --- configure.ac | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/configure.ac b/configure.ac index 837d018e3..19d9ea220 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,22 @@ AC_CANONICAL_HOST AM_PROG_CC_C_O AC_GNU_SOURCE +# Test if we have a new enough compiler. +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#define GCC_VERSION \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) + +#define CLANG_VERSION \ + (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + +#if GCC_VERSION < 40600 && CLANG_VERSION < 10000 +#error Sorry, your compiler is too old - please upgrade it +#endif + ]])], [valid_compiler=yes], [valid_compiler=no]) +if test "x$valid_compiler" = "xno"; then + AC_MSG_ERROR([Sorry, your compiler is too old - please upgrade it]) +fi + # libtool LT_INIT AC_SUBST([LIBTOOL_DEPS]) From 95ef0d7c0de461a198d00ed2406c095004b45aa4 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 22 Aug 2018 01:54:40 +0200 Subject: [PATCH 2/2] start: add out_sync_fini cleanup label Signed-off-by: Christian Brauner --- src/lxc/start.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/lxc/start.c b/src/lxc/start.c index 967d23c1b..6b66e4fb5 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -1651,28 +1651,21 @@ static int lxc_spawn(struct lxc_handler *handler) ret = socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, handler->data_sock); - if (ret < 0) { - lxc_sync_fini(handler); - return -1; - } + if (ret < 0) + goto out_sync_fini; ret = resolve_clone_flags(handler); - if (ret < 0) { - lxc_sync_fini(handler); - return -1; - } + if (ret < 0) + goto out_sync_fini; if (conf->shmount.path_host) { - if (!conf->shmount.path_cont) { - lxc_sync_fini(handler); - return -1; - } + if (!conf->shmount.path_cont) + goto out_sync_fini; ret = lxc_setup_shmount(conf); if (ret < 0) { ERROR("Failed to setup shared mount point"); - lxc_sync_fini(handler); - return -1; + goto out_sync_fini; } } @@ -1687,8 +1680,7 @@ static int lxc_spawn(struct lxc_handler *handler) ret = lxc_find_gateway_addresses(handler); if (ret < 0) { ERROR("Failed to find gateway addresses"); - lxc_sync_fini(handler); - return -1; + goto out_sync_fini; } /* That should be done before the clone because we will @@ -1963,6 +1955,8 @@ out_delete_net: out_abort: lxc_abort(name, handler); + +out_sync_fini: lxc_sync_fini(handler); if (handler->pinfd >= 0) { close(handler->pinfd);