inode.c: fix initialization of i_streams
authorEric Biggers <ebiggers3@gmail.com>
Thu, 26 Mar 2015 04:07:55 +0000 (23:07 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 26 Mar 2015 04:57:42 +0000 (23:57 -0500)
src/dentry.c
src/inode.c

index 302409f..378e16f 100644 (file)
@@ -1299,9 +1299,7 @@ setup_inode_streams(const u8 *p, const u8 *end, struct wim_inode *inode,
 
        inode->i_num_streams = 1 + num_extra_streams;
 
-       if (likely(inode->i_num_streams <= ARRAY_LEN(inode->i_embedded_streams))) {
-               inode->i_streams = inode->i_embedded_streams;
-       } else {
+       if (unlikely(inode->i_num_streams > ARRAY_LEN(inode->i_embedded_streams))) {
                inode->i_streams = CALLOC(inode->i_num_streams,
                                          sizeof(inode->i_streams[0]));
                if (!inode->i_streams)
index 62cab6e..0cf092d 100644 (file)
@@ -59,6 +59,7 @@ new_inode(struct wim_dentry *dentry, bool set_timestamps)
        inode->i_not_rpfixed = 1;
        INIT_LIST_HEAD(&inode->i_list);
        INIT_LIST_HEAD(&inode->i_dentry);
+       inode->i_streams = inode->i_embedded_streams;
        if (set_timestamps) {
                u64 now = now_as_wim_timestamp();
                inode->i_creation_time = now;