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

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