summaryrefslogtreecommitdiff
path: root/source3/lib/tdb/common
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-07-19 13:46:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:28:50 -0500
commit146c0781f39a25a975f9dde562ecc7c913b2357c (patch)
treea385a157ca8c6dd317e1b35468eee5fd6aac2139 /source3/lib/tdb/common
parente4b268b2b5c732e3d17bfbd266f4b30b56a0dc75 (diff)
downloadsamba-146c0781f39a25a975f9dde562ecc7c913b2357c.tar.gz
samba-146c0781f39a25a975f9dde562ecc7c913b2357c.tar.bz2
samba-146c0781f39a25a975f9dde562ecc7c913b2357c.zip
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 e3af95f0983e9f92c10a80ee4f15a0cd718a4728)
Diffstat (limited to 'source3/lib/tdb/common')
-rw-r--r--source3/lib/tdb/common/io.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/source3/lib/tdb/common/io.c b/source3/lib/tdb/common/io.c
index cc66b85b33..ea925f3895 100644
--- a/source3/lib/tdb/common/io.c
+++ b/source3/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;
}