[sheepdog] [PATCH UPDATE] plain: fix prealloc() errno

Liu Yuan namei.unix at gmail.com
Mon Sep 17 13:08:22 CEST 2012


From: Liu Yuan <tailai.ly at taobao.com>

This will fix the spurious failure of tests/042.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/plain_store.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index 5a12278..8e3bd3e 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -305,10 +305,9 @@ int prealloc(int fd, uint32_t size)
 {
 	int ret = fallocate(fd, 0, 0, size);
 	if (ret < 0) {
-		if (errno != ENOSYS && errno != EOPNOTSUPP) {
-			dprintf("%m\n");
-			ret = SD_RES_SYSTEM_ERROR;
-		} else
+		if (errno != ENOSYS && errno != EOPNOTSUPP)
+			ret = err_to_sderr(0, errno); /* FIXME: set oid */
+		else
 			ret = write_last_sector(fd, size);
 	} else
 		ret = SD_RES_SUCCESS;
-- 
1.7.10.2




More information about the sheepdog mailing list