diff options
author | Thierry Strudel | 2015-07-09 11:50:31 -0500 |
---|---|---|
committer | Thierry Strudel | 2015-07-09 23:47:07 -0500 |
commit | df33ffadd29ed02d87e87515626b673eac67f735 (patch) | |
tree | 977968b729fc9fc38859633f12d23dd9f4ba02be /cpio | |
parent | eb528dd5a152d66216b9a2793a3619a65411950c (diff) | |
download | platform-system-core-df33ffadd29ed02d87e87515626b673eac67f735.tar.gz platform-system-core-df33ffadd29ed02d87e87515626b673eac67f735.tar.xz platform-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.c | 10 |
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 { | |||
41 | }; | 41 | }; |
42 | 42 | ||
43 | static struct fs_config_entry* canned_config = NULL; | 43 | static struct fs_config_entry* canned_config = NULL; |
44 | static char *target_out_path = NULL; | ||
44 | 45 | ||
45 | /* Each line in the canned file should be a path plus three ints (uid, | 46 | /* Each line in the canned file should be a path plus three ints (uid, |
46 | * gid, mode). */ | 47 | * gid, mode). */ |
@@ -79,7 +80,8 @@ static void fix_stat(const char *path, struct stat *s) | |||
79 | } else { | 80 | } else { |
80 | // Use the compiled-in fs_config() function. | 81 | // Use the compiled-in fs_config() function. |
81 | unsigned st_mode = s->st_mode; | 82 | unsigned st_mode = s->st_mode; |
82 | fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &st_mode, &capabilities); | 83 | fs_config(path, S_ISDIR(s->st_mode), target_out_path, |
84 | &s->st_uid, &s->st_gid, &st_mode, &capabilities); | ||
83 | s->st_mode = (typeof(s->st_mode)) st_mode; | 85 | s->st_mode = (typeof(s->st_mode)) st_mode; |
84 | } | 86 | } |
85 | } | 87 | } |
@@ -328,6 +330,12 @@ int main(int argc, char *argv[]) | |||
328 | argc--; | 330 | argc--; |
329 | argv++; | 331 | argv++; |
330 | 332 | ||
333 | if (argc > 1 && strcmp(argv[0], "-d") == 0) { | ||
334 | target_out_path = argv[1]; | ||
335 | argc -= 2; | ||
336 | argv += 2; | ||
337 | } | ||
338 | |||
331 | if (argc > 1 && strcmp(argv[0], "-f") == 0) { | 339 | if (argc > 1 && strcmp(argv[0], "-f") == 0) { |
332 | read_canned_config(argv[1]); | 340 | read_canned_config(argv[1]); |
333 | argc -= 2; | 341 | argc -= 2; |