diff mbox series

[3/4] memfd: set up correct errno if not supported

Message ID 20181127111050.18453-4-i.maximets@samsung.com
State New
Headers show
Series memfd fixes. | expand

Commit Message

Ilya Maximets Nov. 27, 2018, 11:10 a.m. UTC
qemu_memfd_create() prints the value of 'errno' which is not
set in this case.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 util/memfd.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Marc-André Lureau Nov. 27, 2018, 11:52 a.m. UTC | #1
On Tue, Nov 27, 2018 at 3:11 PM Ilya Maximets <i.maximets@samsung.com> wrote:
>
> qemu_memfd_create() prints the value of 'errno' which is not
> set in this case.
>
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  util/memfd.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/util/memfd.c b/util/memfd.c
> index d74ce4d793..393d23da96 100644
> --- a/util/memfd.c
> +++ b/util/memfd.c
> @@ -40,6 +40,7 @@ static int memfd_create(const char *name, unsigned int flags)
>  #ifdef __NR_memfd_create
>      return syscall(__NR_memfd_create, name, flags);
>  #else
> +    errno = ENOSYS;
>      return -1;
>  #endif
>  }
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/util/memfd.c b/util/memfd.c
index d74ce4d793..393d23da96 100644
--- a/util/memfd.c
+++ b/util/memfd.c
@@ -40,6 +40,7 @@  static int memfd_create(const char *name, unsigned int flags)
 #ifdef __NR_memfd_create
     return syscall(__NR_memfd_create, name, flags);
 #else
+    errno = ENOSYS;
     return -1;
 #endif
 }