[lxc-devel] [PATCH 17/21] caps.h: Rename __errno to ___errno

Serge Hallyn serge.hallyn at canonical.com
Thu Jan 3 22:03:44 UTC 2013


Quoting Stéphane Graber (stgraber at ubuntu.com):
> At least bionic defines __errno,

And then defines errno in terms of calling __errno() ...

> so this was causing a conflict in caps.h
> leading to build failure. Renaming to ___errno avoids that duplicate
> definition.

s/duplicate/conflicting/ :)

> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  configure.ac   |  5 ++++-
>  src/lxc/caps.h | 12 ++++++------
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 5b7573a..f8a6172 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -213,8 +213,11 @@ AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
>  # Check for some headers
>  AC_CHECK_HEADERS([sys/signalfd.h sys/personality.h sys/capability.h pty.h utmpx.h])
>  
> +# Check for some syscalls functions
> +AC_CHECK_FUNCS([setns pivot_root sethostname unshare])
> +
>  # Check for some functions
> -AC_CHECK_FUNCS([getline fgetln openpty setns pivot_root sethostname unshare])
> +AC_CHECK_FUNCS([getline fgetln openpty hasmntopt setmntent endmntent])
>  
>  # Check for some standard binaries
>  AC_PROG_GCC_TRADITIONAL
> diff --git a/src/lxc/caps.h b/src/lxc/caps.h
> index 9b86215..4114444 100644
> --- a/src/lxc/caps.h
> +++ b/src/lxc/caps.h
> @@ -58,28 +58,28 @@ static inline int lxc_caps_last_cap(void) {
>  #define lxc_priv(__lxc_function)			\
>  	({						\
>  		__label__ out;				\
> -		int __ret, __ret2, __errno = 0;		\
> +		int __ret, __ret2, ___errno = 0;		\
>  		__ret = lxc_caps_up();			\
>  		if (__ret)				\
>  			goto out;			\
>  		__ret = __lxc_function;			\
>  		if (__ret)				\
> -			__errno = errno;		\
> +			___errno = errno;		\
>  		__ret2 = lxc_caps_down();		\
> -	out:	__ret ? errno = __errno,__ret : __ret2;	\
> +	out:	__ret ? errno = ___errno,__ret : __ret2;	\
>  	})
>  
>  #define lxc_unpriv(__lxc_function)			\
>  	({						\
>  		__label__ out;				\
> -		int __ret, __ret2, __errno = 0;		\
> +		int __ret, __ret2, ___errno = 0;		\
>  		__ret = lxc_caps_down();		\
>  		if (__ret)				\
>  			goto out;			\
>  		__ret = __lxc_function;			\
>  		if (__ret)				\
> -			__errno = errno;		\
> +			___errno = errno;		\
>  		__ret2 = lxc_caps_up();			\
> -	out:	__ret ? errno = __errno,__ret : __ret2;	\
> +	out:	__ret ? errno = ___errno,__ret : __ret2;	\
>  	})
>  #endif
> -- 
> 1.8.0
> 
> 
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list