bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] libstore: Fix zero store writes


From: Sergey Bugaev
Subject: [PATCH] libstore: Fix zero store writes
Date: Wed, 4 Dec 2024 14:34:02 +0300

We discard any written data, but we still need to set *amount. Not doing
that is undefined behavior, and causes the write to appear to fail. This
is the cause of a libzstd test failure on GNU/Hurd in particular.

Reported-by: Diego Nieto Cid <dnietoc@gmail.com>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---

Note: not tested, unlike the glibc patch, but what could go wrong here?

 libstore/zero.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libstore/zero.c b/libstore/zero.c
index b35d29a5..37c239b5 100644
--- a/libstore/zero.c
+++ b/libstore/zero.c
@@ -51,6 +51,7 @@ zero_write (struct store *store,
            store_offset_t addr, size_t index, const void *buf, size_t len,
            size_t *amount)
 {
+  *amount = len;
   return 0;
 }
 
-- 
2.47.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]