diff options
author | Sen Jiang <senj@google.com> | 2016-11-07 15:08:07 -0800 |
---|---|---|
committer | Sen Jiang <senj@google.com> | 2017-03-01 10:58:35 -0800 |
commit | 8bad64c4073daa7e7b6f634e9a39790f54b52f9c (patch) | |
tree | e47a7e88d56960f5721ec1719e54e6fb6c0071f1 | |
parent | 3b926aebfee7d8a0f7dda644ecf755df45652643 (diff) | |
download | platform_external_libbrillo-8bad64c4073daa7e7b6f634e9a39790f54b52f9c.tar.gz platform_external_libbrillo-8bad64c4073daa7e7b6f634e9a39790f54b52f9c.tar.bz2 platform_external_libbrillo-8bad64c4073daa7e7b6f634e9a39790f54b52f9c.zip |
Don't crash if /oem/os-release.d/product_id does not exist.
Now that we have symlinks in os-release.d, it might fail if the file
it points to does not exist, this is not a FATAL error.
Test: update_engine no longer crash when /oem/os-release.d/product_id does not exist
Bug: 32555385
Change-Id: I6c0bc9fa4fdf28ce2e8aef7070e0def7704bd073
(cherry picked from commit 65bf5631440fb3d6887ce3bf5a7d05f31f714421)
-rw-r--r-- | brillo/osrelease_reader.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/brillo/osrelease_reader.cc b/brillo/osrelease_reader.cc index 6e4bf90..c8f660e 100644 --- a/brillo/osrelease_reader.cc +++ b/brillo/osrelease_reader.cc @@ -41,9 +41,8 @@ void OsReleaseReader::Load(const base::FilePath& root_dir) { path = enumerator.Next()) { std::string content; if (!base::ReadFileToString(path, &content)) { - // The only way to fail is if a file exist in /etc/os-release.d but we - // cannot read it. - PLOG(FATAL) << "Could not read " << path.value(); + PLOG(ERROR) << "Could not read " << path.value(); + continue; } // There might be a trailing new line. Strip it to keep only the first line // of the file. |