summaryrefslogtreecommitdiffstats
path: root/cpio
diff options
context:
space:
mode:
authorTao Bao2016-10-07 12:20:52 -0500
committerTao Bao2016-10-07 18:14:27 -0500
commit3b5fbd833141fde386615176cd6989b51491b15a (patch)
treeefe6bcd03bda29aa9a8c916a819f97df04571af9 /cpio
parent8caf4e7443527a7b587020cec1559f7e498d0023 (diff)
downloadplatform-system-core-3b5fbd833141fde386615176cd6989b51491b15a.tar.gz
platform-system-core-3b5fbd833141fde386615176cd6989b51491b15a.tar.xz
platform-system-core-3b5fbd833141fde386615176cd6989b51491b15a.zip
mkbootfs: Fix the default st_mode for root directory.
CL in [1] fixed the wrong mode for the root directory from 0644 to 0755. However it only handles the path by calling mkbootfs with canned fs_config (i.e. with -f flag). When calling mkbootfs without -f flag, it still treats the root directory as a file. This renders the generated boot/recovery images w/ and w/o -f being different, and leads to the incorrect checksums in /system/bin/install-recovery.sh. [1] commit aa8f2f65a030f71506277e2a8d64d83a099e9feb. Bug: 31988535 Test: `make dist` and verify the checksums in /system/bin/install-recovery.sh. Change-Id: Ib50fadb23367da0b46944ae0579093da21412593
Diffstat (limited to 'cpio')
-rw-r--r--cpio/mkbootfs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpio/mkbootfs.c b/cpio/mkbootfs.c
index 0e3532304..b89c3952c 100644
--- a/cpio/mkbootfs.c
+++ b/cpio/mkbootfs.c
@@ -51,6 +51,8 @@ static char *target_out_path = NULL;
51#define CANNED_LINE_LENGTH (1024) 51#define CANNED_LINE_LENGTH (1024)
52#endif 52#endif
53 53
54#define TRAILER "TRAILER!!!"
55
54static int verbose = 0; 56static int verbose = 0;
55static int total_size = 0; 57static int total_size = 0;
56 58
@@ -80,8 +82,8 @@ static void fix_stat(const char *path, struct stat *s)
80 } else { 82 } else {
81 // Use the compiled-in fs_config() function. 83 // Use the compiled-in fs_config() function.
82 unsigned st_mode = s->st_mode; 84 unsigned st_mode = s->st_mode;
83 fs_config(path, S_ISDIR(s->st_mode), target_out_path, 85 int is_dir = S_ISDIR(s->st_mode) || strcmp(path, TRAILER) == 0;
84 &s->st_uid, &s->st_gid, &st_mode, &capabilities); 86 fs_config(path, is_dir, target_out_path, &s->st_uid, &s->st_gid, &st_mode, &capabilities);
85 s->st_mode = (typeof(s->st_mode)) st_mode; 87 s->st_mode = (typeof(s->st_mode)) st_mode;
86 } 88 }
87} 89}
@@ -140,7 +142,7 @@ static void _eject_trailer()
140{ 142{
141 struct stat s; 143 struct stat s;
142 memset(&s, 0, sizeof(s)); 144 memset(&s, 0, sizeof(s));
143 _eject(&s, "TRAILER!!!", 10, 0, 0); 145 _eject(&s, TRAILER, 10, 0, 0);
144 146
145 while(total_size & 0xff) { 147 while(total_size & 0xff) {
146 total_size++; 148 total_size++;