From: Michael Vrable Date: Wed, 13 Jan 2010 19:04:27 +0000 (-0800) Subject: Fix for a segfault when resizing files. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=353c0424e56002c6a662df81108f2e9c84190cf1;p=bluesky.git 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. --- 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);