summaryrefslogtreecommitdiffstats
path: root/cpio
diff options
context:
space:
mode:
authorThierry Strudel <tstrudel@google.com>2015-07-09 09:50:31 -0700
committerThierry Strudel <tstrudel@google.com>2015-07-09 21:47:07 -0700
commitdf33ffadd29ed02d87e87515626b673eac67f735 (patch)
tree977968b729fc9fc38859633f12d23dd9f4ba02be /cpio
parenteb528dd5a152d66216b9a2793a3619a65411950c (diff)
downloadsystem_core-df33ffadd29ed02d87e87515626b673eac67f735.tar.gz
system_core-df33ffadd29ed02d87e87515626b673eac67f735.tar.bz2
system_core-df33ffadd29ed02d87e87515626b673eac67f735.zip
fs_config: replace getenv('OUT') by new fs_config parameter
Using a getenv('OUT') in such a deep down function is a wrong design choice. Replacing with explicit parameter that may be NULL in case device specific files can be accessed from /. Since TARGET_COPY_OUT_SYSTEM may be defined to something different than system we also ensure that we use a path relative to TARGET_OUT to compute path to fs_config_* files. Bug: 21989305 Bug: 22048934 Change-Id: Id91bc183b29beac7379d1117ad83bd3346e6897b Signed-off-by: Thierry Strudel <tstrudel@google.com>
Diffstat (limited to 'cpio')
-rw-r--r--cpio/mkbootfs.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/cpio/mkbootfs.c b/cpio/mkbootfs.c
index 7175749b1..0e3532304 100644
--- a/cpio/mkbootfs.c
+++ b/cpio/mkbootfs.c
@@ -41,6 +41,7 @@ struct fs_config_entry {
};
static struct fs_config_entry* canned_config = NULL;
+static char *target_out_path = NULL;
/* Each line in the canned file should be a path plus three ints (uid,
* gid, mode). */
@@ -79,7 +80,8 @@ static void fix_stat(const char *path, struct stat *s)
} else {
// Use the compiled-in fs_config() function.
unsigned st_mode = s->st_mode;
- fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &st_mode, &capabilities);
+ fs_config(path, S_ISDIR(s->st_mode), target_out_path,
+ &s->st_uid, &s->st_gid, &st_mode, &capabilities);
s->st_mode = (typeof(s->st_mode)) st_mode;
}
}
@@ -328,6 +330,12 @@ int main(int argc, char *argv[])
argc--;
argv++;
+ if (argc > 1 && strcmp(argv[0], "-d") == 0) {
+ target_out_path = argv[1];
+ argc -= 2;
+ argv += 2;
+ }
+
if (argc > 1 && strcmp(argv[0], "-f") == 0) {
read_canned_config(argv[1]);
argc -= 2;