From c7edf078f92c7ce083f8c243a79f8aecdfff4ac1 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Tue, 3 Oct 2017 09:57:55 -0700 Subject: Use -Werror in frameworks/base * Fix unused variable and return value warnings. Bug: 66996870 Test: build with WITH_TIDY=1 Change-Id: I890e65a20848d00559ba5a4f9691be1347b456af --- tools/bit/main.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'tools/bit/main.cpp') diff --git a/tools/bit/main.cpp b/tools/bit/main.cpp index d056ba53ca84..ad23971152b2 100644 --- a/tools/bit/main.cpp +++ b/tools/bit/main.cpp @@ -561,6 +561,15 @@ check_device_property(const string& property, const string& expected) } } +static void +chdir_or_exit(const char *path) { + // TODO: print_command("cd", path); + if (0 != chdir(path)) { + print_error("Error: Could not chdir: %s", path); + exit(1); + } +} + /** * Run the build, install, and test actions. */ @@ -583,8 +592,7 @@ run_phases(vector targets, const Options& options) const string buildId = get_build_var(buildTop, "BUILD_ID", false); const string buildOut = get_out_dir(); - // TODO: print_command("cd", buildTop.c_str()); - chdir(buildTop.c_str()); + chdir_or_exit(buildTop.c_str()); // Get the modules for the targets map modules; @@ -952,7 +960,7 @@ run_tab_completion(const string& word) const string buildProduct = get_required_env("TARGET_PRODUCT", false); const string buildOut = get_out_dir(); - chdir(buildTop.c_str()); + chdir_or_exit(buildTop.c_str()); string buildDevice = sniff_device_name(buildOut, buildProduct); -- cgit v1.2.3-59-g8ed1b