wok diff busybox/stuff/busybox-1.10.0-cpio.u @ rev 2950

ecore: fix compile_rules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri May 08 13:46:20 2009 +0200 (2009-05-08)
parents 552d9bd2b795
children
line diff
     1.1 --- a/busybox/stuff/busybox-1.10.0-cpio.u	Sat Apr 19 12:09:45 2008 +0000
     1.2 +++ b/busybox/stuff/busybox-1.10.0-cpio.u	Fri May 08 13:46:20 2009 +0200
     1.3 @@ -56,6 +56,7 @@
     1.4  +        char *line = xmalloc_getline(stdin);
     1.5  +        // allocate inode struct each loop to avoid struct stat copy
     1.6  +        struct inodes_s *inode = xzalloc(sizeof(*inode)); // die if fail
     1.7 ++        off_t size;
     1.8  +
     1.9  +        inode->st.st_nlink++; // =1
    1.10  +        if (line) {
    1.11 @@ -71,7 +72,6 @@
    1.12  +            if (!S_ISLNK(inode->st.st_mode) && !S_ISREG(inode->st.st_mode))
    1.13  +                inode->st.st_size = 0;
    1.14  +        }
    1.15 -+
    1.16  +        // hard links will are stored and will be processed later
    1.17  +        if (!S_ISDIR(inode->st.st_mode) && inode->st.st_nlink > 1) {
    1.18  +            struct name_s *n;
    1.19 @@ -89,7 +89,7 @@
    1.20  +            l->names = n; // will not free inode if l == inode
    1.21  +            goto free_and_continue;
    1.22  +        }
    1.23 -+
    1.24 ++        size = inode->st.st_size;
    1.25  +        // no more files ? process hard links
    1.26  +        if (!line && links) {
    1.27  +            struct name_s *n;
    1.28 @@ -99,9 +99,10 @@
    1.29  +            n = links->names;
    1.30  +            name = line = xstrdup(n->name);    // line will free *name memory
    1.31  +            links->names = n->next;
    1.32 -+            if (links->names == NULL)          // inode will free *links memory
    1.33 ++            if (links->names == NULL) {        // inode will free *links memory
    1.34 ++                size = links->st.st_size;
    1.35  +                links = links->next;
    1.36 -+            else links->st.st_size = 0;        // not last link: no data
    1.37 ++            }
    1.38  +            free(n);
    1.39  +        }
    1.40  +        bytes += printf("070701%08lx%08lx%08lx%08lx%08lx%08lx%08lx"
    1.41 @@ -112,15 +113,14 @@
    1.42  +                        (unsigned long) inode->st.st_gid,
    1.43  +                        (unsigned long) inode->st.st_nlink,
    1.44  +                        (unsigned long) inode->st.st_mtime,
    1.45 -+                        (unsigned long) inode->st.st_size,
    1.46 ++                        (unsigned long) size,
    1.47  +                        (unsigned long) major(inode->st.st_dev),
    1.48  +                        (unsigned long) minor(inode->st.st_dev),
    1.49  +                        (unsigned long) major(inode->st.st_rdev), 
    1.50  +                        (unsigned long) minor(inode->st.st_rdev),
    1.51  +                        strlen(name) + 1UL, 0UL, name, 0);
    1.52 -+
    1.53  +        cpio_pad(&bytes, (line) ? 4-1 : 512-1);
    1.54 -+        if (inode->st.st_size) {
    1.55 ++        if (size) {
    1.56  +            if (S_ISLNK(inode->st.st_mode)) {
    1.57  +                char *lpath = xmalloc_readlink_or_warn(name);
    1.58  +