trim whitespace from /etc/timezone

This commit is contained in:
Scott Lamb
2021-09-24 10:49:04 -07:00
parent 0c0c0692f3
commit 82102c0d17
2 changed files with 6 additions and 2 deletions

View File

@@ -149,9 +149,9 @@ fn resolve_zone() -> Result<String, Error> {
}
};
// If `TIMEZONE_PATH` is a file, use its contents as the zone name.
// If `TIMEZONE_PATH` is a file, use its contents as the zone name, trimming whitespace.
match ::std::fs::read_to_string(TIMEZONE_PATH) {
Ok(z) => Ok(z),
Ok(z) => Ok(z.trim().to_owned()),
Err(e) => {
bail!(
"Unable to resolve timezone from TZ env, {}, or {}. Last error: {}",