From d568e2b1d3ae65d2f7a7fd2c6e7e317b396ebbcf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 19 Jul 2007 13:46:26 +0000 Subject: r23972: Fix a bug in pwrite error detection in tdb_expand_file(): The proper error condition is (ret == -1) instead of (ret != number_of_byte_told_to_write). Michael (This used to be commit 4c3c6363f860ec01d3c789ef8ee2aa3eb77000dc) --- source4/lib/tdb/common/io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/lib/tdb') diff --git a/source4/lib/tdb/common/io.c b/source4/lib/tdb/common/io.c index cc66b85b33..ea925f3895 100644 --- a/source4/lib/tdb/common/io.c +++ b/source4/lib/tdb/common/io.c @@ -234,13 +234,13 @@ static int tdb_expand_file(struct tdb_context *tdb, tdb_off_t size, tdb_off_t ad while (addition) { int n = addition>sizeof(buf)?sizeof(buf):addition; int ret = pwrite(tdb->fd, buf, n, size); - if (ret != n) { + if (ret == -1) { TDB_LOG((tdb, TDB_DEBUG_FATAL, "expand_file write of %d failed (%s)\n", n, strerror(errno))); return -1; } - addition -= n; - size += n; + addition -= ret; + size += ret; } return 0; } -- cgit