Blame SOURCES/cryptsetup-2.0.4-fix-write_lseek_blockwise-for-in-the-middle-of-secto.patch

7cdc99
From 6392be68c4d481148e20dbc2a8380cc246f27ad1 Mon Sep 17 00:00:00 2001
7cdc99
From: Ondrej Kozina <okozina@redhat.com>
7cdc99
Date: Tue, 19 Jun 2018 14:45:45 +0200
7cdc99
Subject: [PATCH 2/4] Fix write_lseek_blockwise for in the middle of sector
7cdc99
 case.
7cdc99
7cdc99
See unit test write_lseek_blockwise(bsize=512, offset=1, length=1).
7cdc99
7cdc99
The test tries to modify single byte at offset 1 of device with
7cdc99
bsize=512.
7cdc99
---
7cdc99
 lib/utils_io.c | 4 ++--
7cdc99
 1 file changed, 2 insertions(+), 2 deletions(-)
7cdc99
7cdc99
diff --git a/lib/utils_io.c b/lib/utils_io.c
7cdc99
index 94c4ef6..8336b18 100644
7cdc99
--- a/lib/utils_io.c
7cdc99
+++ b/lib/utils_io.c
7cdc99
@@ -216,8 +216,8 @@ ssize_t write_lseek_blockwise(int fd, size_t bsize, size_t alignment,
7cdc99
 		if (lseek(fd, offset - frontHang, SEEK_SET) < 0)
7cdc99
 			goto out;
7cdc99
 
7cdc99
-		r = write_buffer(fd, frontPadBuf, frontHang + innerCount);
7cdc99
-		if (r < 0 || r != (ssize_t)(frontHang + innerCount))
7cdc99
+		r = write_buffer(fd, frontPadBuf, bsize);
7cdc99
+		if (r < 0 || r != (ssize_t)bsize)
7cdc99
 			goto out;
7cdc99
 
7cdc99
 		buf = (char*)buf + innerCount;
7cdc99
-- 
7cdc99
1.8.3.1
7cdc99