If "rados put" uses write instead of write_full, the resulting object on
the server may be a mismash of old and new objects, if the old object
was longer than the new one. This is fairly counterintuitive behavior
for radostool, so remove it.
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
indata.append('\n');
}
} else {
- int fd = open(infile, O_RDONLY);
+ int ret, fd = open(infile, O_RDONLY);
if (fd < 0) {
char buf[80];
cerr << "error reading input file " << infile << ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl;
continue;
}
indata.append(buf, count);
- int ret = io_ctx.write(oid, indata, count, offset);
+ if (offset == 0)
+ ret = io_ctx.write_full(oid, indata);
+ else
+ ret = io_ctx.write(oid, indata, count, offset);
indata.clear();
if (ret < 0) {