aboutsummaryrefslogtreecommitdiff
path: root/tools/c-index-test
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-17 20:19:56 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-12-17 20:19:56 +0000
commit2bff7e5a02495dabd26013c15613f082fce67633 (patch)
tree7e9208472fbc4bcf8d23b6c4aa19cb56a933b34d /tools/c-index-test
parent6e48a2e2d677d9ba97b457e0af3494d6b6387380 (diff)
[c-index-test] Fix warnings about unused results from chdir().
Patch from Edwin Vane! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170366 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/c-index-test')
-rw-r--r--tools/c-index-test/c-index-test.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index 7a36d093a5..be2b6fc584 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/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);