diff mbox series

[for-4.14,2/2] tools: fix setting of errno in xenhypfs_read_raw()

Message ID 20200609144850.28619-3-jgross@suse.com (mailing list archive)
State New, archived
Headers show
Series tools: two minor fixes for libxenhypfs | expand

Commit Message

Jürgen Groß June 9, 2020, 2:48 p.m. UTC
Setting of errno is wrong in xenhypfs_read_raw(), fix it.

Reported-by: George Dunlap <george.dunlap@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 tools/libs/hypfs/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Paul Durrant June 9, 2020, 3:02 p.m. UTC | #1
> -----Original Message-----
> From: Juergen Gross <jgross@suse.com>
> Sent: 09 June 2020 15:49
> To: xen-devel@lists.xenproject.org
> Cc: paul@xen.org; Juergen Gross <jgross@suse.com>; Ian Jackson <ian.jackson@eu.citrix.com>; Wei Liu
> <wl@xen.org>; George Dunlap <george.dunlap@citrix.com>
> Subject: [PATCH for-4.14 2/2] tools: fix setting of errno in xenhypfs_read_raw()
> 
> Setting of errno is wrong in xenhypfs_read_raw(), fix it.
> 
> Reported-by: George Dunlap <george.dunlap@citrix.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Paul Durrant <paul@xen.org>
Release-acked-by: Paul Durrant <paul@xen.org>

> ---
>  tools/libs/hypfs/core.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c
> index fc23b02586..f94c5ea1e2 100644
> --- a/tools/libs/hypfs/core.c
> +++ b/tools/libs/hypfs/core.c
> @@ -241,10 +241,8 @@ void *xenhypfs_read_raw(xenhypfs_handle *fshdl, const char *path,
>          if (!ret)
>              break;
> 
> -        if (ret != ENOBUFS) {
> -            errno = -ret;
> +        if (errno != ENOBUFS)
>              goto out;
> -        }
>      }
> 
>      content = malloc(entry->content_len);
> --
> 2.26.2
diff mbox series

Patch

diff --git a/tools/libs/hypfs/core.c b/tools/libs/hypfs/core.c
index fc23b02586..f94c5ea1e2 100644
--- a/tools/libs/hypfs/core.c
+++ b/tools/libs/hypfs/core.c
@@ -241,10 +241,8 @@  void *xenhypfs_read_raw(xenhypfs_handle *fshdl, const char *path,
         if (!ret)
             break;
 
-        if (ret != ENOBUFS) {
-            errno = -ret;
+        if (errno != ENOBUFS)
             goto out;
-        }
     }
 
     content = malloc(entry->content_len);