[lxc-devel] [PATCH] remove the return value of attach_ns.

Serge Hallyn serge.hallyn at ubuntu.com
Thu Jan 2 15:27:26 UTC 2014


Quoting Rami Rosen (ramirose at gmail.com):
> This method removes the return value of the attach_ns() method as it is 
> not needed and not used.
> 
> Signed-off-by: Rami Rosen <ramirose at gmail.com>

I think it'd be better to fail on error at the callers - if we
failed to switch namespaces and proceed in starting the container,
bad things can happen even on the host.

> ---
>  src/lxc/start.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lxc/start.c b/src/lxc/start.c
> index 7395aea..a89d3e6 100644
> --- a/src/lxc/start.c
> +++ b/src/lxc/start.c
> @@ -125,7 +125,7 @@ error:
>  	return -1;
>  }
>  
> -static int attach_ns(const int ns_fd[LXC_NS_MAX]) {
> +static void attach_ns(const int ns_fd[LXC_NS_MAX]) {
>  	int i;
>  
>  	for (i = 0; i < LXC_NS_MAX; i++) {
> @@ -135,11 +135,10 @@ static int attach_ns(const int ns_fd[LXC_NS_MAX]) {
>  		if (setns(ns_fd[i], 0) != 0)
>  			goto error;
>  	}
> -	return 0;
> +	return;
>  
>  error:
>  	SYSERROR("failed to set namespace '%s'", ns_info[i].proc_name);
> -	return -1;
>  }
>  
>  static int match_fd(int fd)
> -- 
> 1.8.1.4
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list