summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/update_to_1.95.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/genext2fs/genext2fs-1.4.1/update_to_1.95.patch')
-rw-r--r--meta/recipes-devtools/genext2fs/genext2fs-1.4.1/update_to_1.95.patch119
1 files changed, 119 insertions, 0 deletions
diff --git a/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/update_to_1.95.patch b/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/update_to_1.95.patch
new file mode 100644
index 0000000000..ea2b16ccf9
--- /dev/null
+++ b/meta/recipes-devtools/genext2fs/genext2fs-1.4.1/update_to_1.95.patch
@@ -0,0 +1,119 @@
1See http://genext2fs.cvs.sourceforge.net/viewvc/genext2fs/genext2fs/genext2fs.c?view=log
2
3The latest version of genext2fs.c is the v1.95 in the cvs repo:
4http://genext2fs.cvs.sourceforge.net/viewvc/genext2fs/genext2fs/genext2fs.c?revision=1.95
5
6First let's upgrade to the version.
7
8Upstream-Status: inappropriate
9
10Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
11
12--- a/genext2fs.c 2007-03-26 22:19:59.000000000 +0800
13+++ b/genext2fs.c 2012-03-28 22:15:03.678856820 +0800
14@@ -286,7 +286,9 @@
15 // older solaris. Note that this is still not very portable, in that
16 // the return value cannot be trusted.
17
18-#if SCANF_CAN_MALLOC
19+#if 0 // SCANF_CAN_MALLOC
20+// C99 define "a" for floating point, so you can have runtime surprise
21+// according the library versions
22 # define SCANF_PREFIX "a"
23 # define SCANF_STRING(s) (&s)
24 #else
25@@ -778,7 +780,7 @@
26 if(hdlinks.hdl[i].src_inode == inode)
27 return i;
28 }
29- return -1;
30+ return -1;
31 }
32
33 // printf helper macro
34@@ -1356,20 +1358,23 @@
35 return nod;
36 }
37
38+// chmod an inode
39+void
40+chmod_fs(filesystem *fs, uint32 nod, uint16 mode, uint16 uid, uint16 gid)
41+{
42+ inode *node;
43+ node = get_nod(fs, nod);
44+ node->i_mode = (node->i_mode & ~FM_IMASK) | (mode & FM_IMASK);
45+ node->i_uid = uid;
46+ node->i_gid = gid;
47+}
48+
49 // create a simple inode
50 static uint32
51 mknod_fs(filesystem *fs, uint32 parent_nod, const char *name, uint16 mode, uint16 uid, uint16 gid, uint8 major, uint8 minor, uint32 ctime, uint32 mtime)
52 {
53 uint32 nod;
54 inode *node;
55- if((nod = find_dir(fs, parent_nod, name)))
56- {
57- node = get_nod(fs, nod);
58- if((node->i_mode & FM_IFMT) != (mode & FM_IFMT))
59- error_msg_and_die("node '%s' already exists and isn't of the same type", name);
60- node->i_mode = mode;
61- }
62- else
63 {
64 nod = alloc_nod(fs);
65 node = get_nod(fs, nod);
66@@ -1591,13 +1596,24 @@
67 dname = malloc(len + 1);
68 for(i = start; i < count; i++)
69 {
70+ uint32 oldnod;
71 SNPRINTF(dname, len, "%s%lu", name, i);
72- mknod_fs(fs, nod, dname, mode, uid, gid, major, minor + (i * increment - start), ctime, mtime);
73+ oldnod = find_dir(fs, nod, dname);
74+ if(oldnod)
75+ chmod_fs(fs, oldnod, mode, uid, gid);
76+ else
77+ mknod_fs(fs, nod, dname, mode, uid, gid, major, minor + (i * increment - start), ctime, mtime);
78 }
79 free(dname);
80 }
81 else
82- mknod_fs(fs, nod, name, mode, uid, gid, major, minor, ctime, mtime);
83+ {
84+ uint32 oldnod = find_dir(fs, nod, name);
85+ if(oldnod)
86+ chmod_fs(fs, oldnod, mode, uid, gid);
87+ else
88+ mknod_fs(fs, nod, name, mode, uid, gid, major, minor, ctime, mtime);
89+ }
90 }
91 }
92 if (line)
93@@ -1664,6 +1680,17 @@
94 }
95 else
96 {
97+ if((nod = find_dir(fs, this_nod, name)))
98+ {
99+ error_msg("ignoring duplicate entry %s", name);
100+ if(S_ISDIR(st.st_mode)) {
101+ if(chdir(dent->d_name) < 0)
102+ perror_msg_and_die(name);
103+ add2fs_from_dir(fs, nod, squash_uids, squash_perms, fs_timestamp, stats);
104+ chdir("..");
105+ }
106+ continue;
107+ }
108 save_nod = 0;
109 /* Check for hardlinks */
110 if (!S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode) && st.st_nlink > 1) {
111@@ -1994,7 +2021,7 @@
112 //system blocks
113 for(j = 1; j <= overhead_per_group; j++)
114 allocate(bbm, j);
115-
116+
117 /* Inode bitmap */
118 ibm = get_blk(fs,fs->gd[i].bg_inode_bitmap);
119 //non-filesystem inodes