]> wimlib.net Git - wimlib/commitdiff
Do not add lookup table entry for empty files
authorEric Biggers <ebiggers3@gmail.com>
Tue, 28 Aug 2012 03:21:39 +0000 (22:21 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 28 Aug 2012 03:21:39 +0000 (22:21 -0500)
src/lookup_table.c
src/modify.c

index c491f076e23c682c473ce5e0c824ac51c0796887..d15a3088d3675578227cfc82438f012242e7c5fe 100644 (file)
@@ -266,10 +266,6 @@ int write_lookup_table_entry(struct lookup_table_entry *lte, void *__out)
 
        out = __out;
 
-       /* do not write lookup table entries for empty files */
-       if (lte->output_resource_entry.original_size == 0)
-               return 0;
-
        /* Don't write entries that have not had file resources or metadata
         * resources written for them. */
        if (lte->out_refcnt == 0)
index 141f2dd8aac45cb0de271803cb2a6d71a4258f8e..ff6e106cfba9b9eeb6e2e2bedb2214f10a93c8bf 100644 (file)
@@ -186,6 +186,10 @@ static int build_dentry_tree(struct dentry **root_ret, const char *root_disk_pat
                struct lookup_table_entry *lte;
                u8 hash[SHA1_HASH_SIZE];
 
+               /* Empty files do not have to have a lookup table entry. */
+               if (root_stbuf.st_size == 0)
+                       goto out;
+
                /* For each regular file, we must check to see if the file is in
                 * the lookup table already; if it is, we increment its refcnt;
                 * otherwise, we create a new lookup table entry and insert it.
@@ -219,6 +223,7 @@ static int build_dentry_tree(struct dentry **root_ret, const char *root_disk_pat
                }
                root->lte = lte;
        }
+out:
        *root_ret = root;
        return ret;
 }