[cfe-commits] r170366 - /cfe/trunk/tools/c-index-test/c-index-test.c
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Dec 17 12:19:56 PST 2012
Author: akirtzidis
Date: Mon Dec 17 14:19:56 2012
New Revision: 170366
URL: http://llvm.org/viewvc/llvm-project?rev=170366&view=rev
Log:
[c-index-test] Fix warnings about unused results from chdir().
Patch from Edwin Vane!
Modified:
cfe/trunk/tools/c-index-test/c-index-test.c
Modified: cfe/trunk/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=170366&r1=170365&r2=170366&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)
+++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Dec 17 14:19:56 2012
@@ -2813,9 +2813,13 @@
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 @@
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);
More information about the cfe-commits
mailing list