diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-17 20:19:56 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-17 20:19:56 +0000 |
commit | fdea813c4ae17c47386f6a1ecaa429cd03bc6360 (patch) | |
tree | 9b44ee6785a826f372f1d967428ef350ae9760af /clang/tools/c-index-test/c-index-test.c | |
parent | 40f6c2ac9c4f879522ddd1c97aa48f44119b3e59 (diff) | |
download | bcm5719-llvm-fdea813c4ae17c47386f6a1ecaa429cd03bc6360.tar.gz bcm5719-llvm-fdea813c4ae17c47386f6a1ecaa429cd03bc6360.zip |
[c-index-test] Fix warnings about unused results from chdir().
Patch from Edwin Vane!
llvm-svn: 170366
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r-- | clang/tools/c-index-test/c-index-test.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c index 7a36d093a5c..be2b6fc5849 100644 --- a/clang/tools/c-index-test/c-index-test.c +++ b/clang/tools/c-index-test/c-index-test.c @@ -2813,9 +2813,13 @@ static int index_compile_db(int argc, const char **argv) { goto cdb_end; } - chdir(buildDir); - CCmds = clang_CompilationDatabase_getAllCompileCommands(db); + if (chdir(buildDir) != 0) { + printf("Could not chdir to %s\n", buildDir); + errorCode = -1; + goto cdb_end; + } + CCmds = clang_CompilationDatabase_getAllCompileCommands(db); if (!CCmds) { printf("compilation db is empty\n"); errorCode = -1; @@ -2834,7 +2838,11 @@ static int index_compile_db(int argc, const char **argv) { CCmd = clang_CompileCommands_getCommand(CCmds, i); wd = clang_CompileCommand_getDirectory(CCmd); - chdir(clang_getCString(wd)); + if (chdir(clang_getCString(wd)) != 0) { + printf("Could not chdir to %s\n", clang_getCString(wd)); + errorCode = -1; + goto cdb_end; + } clang_disposeString(wd); numArgs = clang_CompileCommand_getNumArgs(CCmd); |