add: if (blksize) { stbuf->st_blksize = blksize; stbuf->st_blocks = ((size + blksize - 1) & ~(blksize - 1)) >> 9; }
context: static int buf_get_attrs(struct buffer *buf, struct stat *stbuf){    uint32_t flags;    uint64_t size = 0;    uint32_t uid = 0;    uint32_t gid = 0;    uint32_t atime = 0;    uint32_t mtime = 0;    uint32_t mode = S_IFREG | 0777;    if (buf_get_uint32(buf, &flags) == -1)        return -1;    if ((flags & SSH_FILEXFER_ATTR_SIZE) &&        buf_get_uint64(buf, &size) == -1)        return -1;    if ((flags & SSH_FILEXFER_ATTR_UIDGID) &&        (buf_get_uint32(buf, &uid) == -1 ||         buf_get_uint32(buf, &gid) == -1))        return -1;    if ((flags & SSH_FILEXFER_ATTR_PERMISSIONS) &&        buf_get_uint32(buf, &mode) == -1)        return -1;    if ((flags & SSH_FILEXFER_ATTR_ACMODTIME)) {        if (buf_get_uint32(buf, &atime) == -1 ||            buf_get_uint32(buf, &mtime) == -1)            return -1;    }    if ((flags & SSH_FILEXFER_ATTR_EXTENDED)) {        uint32_t extcount;        unsigned i;        if (buf_get_uint32(buf, &extcount) == -1)            return -1;        for (i = 0; i < extcount; i++) {            struct buffer tmp;            if (buf_get_data(buf, &tmp) == -1)                return -1;            buf_free(&tmp);            if (buf_get_data(buf, &tmp) == -1)                return -1;            buf_free(&tmp);        }    }    memset(stbuf, 0, sizeof(struct stat));    stbuf->st_mode = mode;    stbuf->st_nlink = 1;    stbuf->st_size = size;    stbuf->st_uid = uid;    stbuf->st_gid = gid;    stbuf->st_atime = atime;    stbuf->st_mtime = mtime;    return 0;}