[PATCH 2/5] Add an errno validation function

Oren Laadan orenl at librato.com
Wed Jul 22 20:17:40 PDT 2009



Dan Smith wrote:
> Signed-off-by: Dan Smith <danms at us.ibm.com>
> ---
>  include/linux/checkpoint.h |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/checkpoint.h b/include/linux/checkpoint.h
> index 2e9772e..93efa10 100644
> --- a/include/linux/checkpoint.h
> +++ b/include/linux/checkpoint.h
> @@ -261,6 +261,11 @@ extern void *restore_sighand(struct ckpt_ctx *ctx);
>  			memcpy(LIVE, SAVE, count * sizeof(*SAVE));	\
>  	} while (0)
>  
> +static inline int ckpt_validate_errno(int errno)
> +{
> +	/* Current highest errno is ~530; this should provide some sanity */
> +	return (errno >= 0) && (errno < 1024);
> +}
>  

How about:
	return (errno >= 0 || IS_ERR_VALUE(errno));

IS_ERR_VALUE is defined in include/linux/err.h

Oren.


More information about the Containers mailing list