On Mon, Dec 14, 2020 at 05:36:18PM +0100, Manuel Bouyer wrote:
> ---
>  tools/xenpaging/xenpaging.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c
> index 33098046c2..39c8c83b4b 100644
> --- a/tools/xenpaging/xenpaging.c
> +++ b/tools/xenpaging/xenpaging.c
> @@ -180,10 +180,11 @@ static int xenpaging_get_tot_pages(struct xenpaging 
> *paging)
>  static void *init_page(void)
>  {
>      void *buffer;
> +    int rc;
>  
>      /* Allocated page memory */
> -    errno = posix_memalign(&buffer, XC_PAGE_SIZE, XC_PAGE_SIZE);
> -    if ( errno != 0 )
> +    rc = posix_memalign(&buffer, XC_PAGE_SIZE, XC_PAGE_SIZE);
> +    if ( rc != 0 )

I think the point of setting errno here is because posix_memalign
doesn't set it and instead returns an error code. The caller of
init_page uses PERROR in order to print the error which his expected to
be in errno.

I don't think this is the only place in Xen code that errno is set, why
are the others fine but not this instance?

Thanks, Roger.

Reply via email to