[Devel] Re: [PATCH 2/5] Add an errno validation function

Oren Laadan orenl at librato.com
Wed Jul 22 20:19:04 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.
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list