[Sheepdog] [PATCH 3/3] sheep: do the sanity check to mute gcc

Liu Yuan namei.unix at gmail.com
Wed Aug 31 11:44:59 CEST 2011


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




More information about the sheepdog mailing list