From e0ff988ad865f3370ddeb8e75eefd9ed27d6641b Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Wed, 1 Mar 2017 15:50:04 +0100 Subject: memcmp: fix comparison on short read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit read() might return less than $count bytes which is only an upper limit. The user is supposed to repeat the command to fill a buffer completely. So use the convenience wrapper read_full in memcmp. This fixes memcmp on /dev/nand0 on an Armada XP. Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- commands/memcmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'commands/memcmp.c') diff --git a/commands/memcmp.c b/commands/memcmp.c index 7be0033f55..981c8cb38d 100644 --- a/commands/memcmp.c +++ b/commands/memcmp.c @@ -91,13 +91,13 @@ static int do_memcmp(int argc, char *argv[]) now = min((loff_t)RW_BUF_SIZE, count); - r1 = read(sourcefd, mem_rw_buf, now); + r1 = read_full(sourcefd, mem_rw_buf, now); if (r1 < 0) { perror("read"); goto out; } - r2 = read(destfd, rw_buf1, now); + r2 = read_full(destfd, rw_buf1, now); if (r2 < 0) { perror("read"); goto out; -- cgit v1.2.3