diff mbox series

elf: Fix uninitialized variable for _dl_write

Message ID b1170769-c4ee-f3cf-b3e1-252e27f6f21e@huawei.com
State New
Delegated to: Florian Weimer
Headers show
Series elf: Fix uninitialized variable for _dl_write | expand

Commit Message

Shuo Wang Nov. 12, 2020, 9:44 a.m. UTC
elf: Fix uninitialized variable for _dl_write

Variable ret in elf/dl-write.c is uninitialized, which should get return value from __writev.
---
 elf/dl-write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adhemerval Zanella Nov. 12, 2020, 2:41 p.m. UTC | #1
On 12/11/2020 06:44, Shuo Wang wrote:
> elf: Fix uninitialized variable for _dl_write
> 
> Variable ret in elf/dl-write.c is uninitialized, which should get return value from __writev.

LGTM, although it would only impact Hurd.

> ---
>  elf/dl-write.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/elf/dl-write.c b/elf/dl-write.c
> index 7350aff003..9b741c8a8f 100644
> --- a/elf/dl-write.c
> +++ b/elf/dl-write.c
> @@ -41,7 +41,7 @@ _dl_write (int fd, const void *buffer, size_t length)
>    else
>      {
>        __rtld_lock_lock_recursive (GL(dl_load_lock));
> -      __writev (fd, &iov, 1);
> +      ret = __writev (fd, &iov, 1);
>        if (ret < 0)
>          ret = -errno;
>        __rtld_lock_unlock_recursive (GL(dl_load_lock));
>
diff mbox series

Patch

diff --git a/elf/dl-write.c b/elf/dl-write.c
index 7350aff003..9b741c8a8f 100644
--- a/elf/dl-write.c
+++ b/elf/dl-write.c
@@ -41,7 +41,7 @@  _dl_write (int fd, const void *buffer, size_t length)
   else
     {
       __rtld_lock_lock_recursive (GL(dl_load_lock));
-      __writev (fd, &iov, 1);
+      ret = __writev (fd, &iov, 1);
       if (ret < 0)
         ret = -errno;
       __rtld_lock_unlock_recursive (GL(dl_load_lock));