From 353c0424e56002c6a662df81108f2e9c84190cf1 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Wed, 13 Jan 2010 11:04:27 -0800 Subject: [PATCH] Fix for a segfault when resizing files. If we only have a reference to a file block but have not read it in, we don't actually know the size. We maybe ought to have a better fix for this later. --- bluesky/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bluesky/file.c b/bluesky/file.c index 09e4805..9b9f916 100644 --- a/bluesky/file.c +++ b/bluesky/file.c @@ -71,7 +71,8 @@ void bluesky_file_truncate(BlueSkyInode *inode, uint64_t size) inode->blocks->len - 1); if (b->type != BLUESKY_BLOCK_ZERO - && b->data->len < BLUESKY_BLOCK_SIZE) { + && (b->type == BLUESKY_BLOCK_REF + || b->data->len < BLUESKY_BLOCK_SIZE)) { bluesky_block_touch(inode, inode->blocks->len - 1); gsize old_size = b->data->len; bluesky_string_resize(b->data, BLUESKY_BLOCK_SIZE); -- 2.20.1