• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


Commit MetaInfo

Revisionbfa4c8dee51b84f86f7a768cac553b35011efa28 (tree)
Time2019-03-05 14:43:30
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

init: expand variables on mount_all command

This allows mount_all to handle fstab.${ro.hardware} instead
of hardcoding the file name.

Change-Id: Ia7fb4e5a84dd50a46afdd4239b9b06204f449cfe

Change Summary

Incremental Difference

--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -443,13 +443,18 @@ static Result<int> mount_fstab(const char* fstabfile, int mount_mode) {
443443 return Error() << "child aborted";
444444 }
445445 } else if (pid == 0) {
446+ std::string filename_val;
447+ if (!expand_props(fstabfile, &filename_val)) {
448+ PLOG(ERROR) << "mount_all: cannot expand '" << fstabfile << "'";
449+ _exit(-1);
450+ }
446451 /* child, call fs_mgr_mount_all() */
447452
448453 // So we can always see what fs_mgr_mount_all() does.
449454 // Only needed if someone explicitly changes the default log level in their init.rc.
450455 android::base::ScopedLogSeverity info(android::base::INFO);
451456
452- struct fstab* fstab = fs_mgr_read_fstab(fstabfile);
457+ struct fstab* fstab = fs_mgr_read_fstab(filename_val.c_str());
453458 int child_ret = fs_mgr_mount_all(fstab, mount_mode);
454459 fs_mgr_free_fstab(fstab);
455460 if (child_ret == -1) {
@@ -540,7 +545,6 @@ static Result<Success> queue_fs_event(int code) {
540545 * not return.
541546 */
542547 static Result<Success> do_mount_all(const BuiltinArguments& args) {
543- std::size_t na = 0;
544548 bool import_rc = true;
545549 bool queue_event = true;
546550 int mount_mode = MOUNT_MODE_DEFAULT;
@@ -548,7 +552,7 @@ static Result<Success> do_mount_all(const BuiltinArguments& args) {
548552 std::size_t path_arg_end = args.size();
549553 const char* prop_post_fix = "default";
550554
551- for (na = args.size() - 1; na > 1; --na) {
555+ for (std::size_t na = args.size() - 1; na > 1; --na) {
552556 if (args[na] == "--early") {
553557 path_arg_end = na;
554558 queue_event = false;