mirror of
https://github.com/samba-team/samba.git
synced 2025-11-29 16:23:52 +03:00
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 commit is contained in:
committed by
Gerald (Jerry) Carter
parent
f959a0f152
commit
e3af95f098
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user