From: Liu Yuan <tailai.ly at taobao.com> Gcc complains about ftruncate() usage, so mute it. Signed-off-by: Liu Yuan <tailai.ly at taobao.com> --- sheep/store.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sheep/store.c b/sheep/store.c index f541b41..1f0daff 100644 --- a/sheep/store.c +++ b/sheep/store.c @@ -721,8 +721,13 @@ static int store_queue_request_local(struct request *req, uint32_t epoch) break; case SD_OP_WRITE_OBJ: case SD_OP_CREATE_AND_WRITE_OBJ: - if (hdr->flags & SD_FLAG_CMD_TRUNCATE) - ftruncate(fd, hdr->offset + hdr->data_length); + if (hdr->flags & SD_FLAG_CMD_TRUNCATE) { + ret = ftruncate(fd, hdr->offset + hdr->data_length); + if (ret) { + ret = SD_RES_EIO; + goto out; + } + } if (is_vdi_obj(oid)) { jd.jdf_epoch = epoch; -- 1.7.5.1 |