[llvm-commits] [llvm] r98525 - /llvm/trunk/lib/System/Unix/Program.inc
Chris Lattner
sabre at nondot.org
Sun Mar 14 16:16:45 PDT 2010
Author: lattner
Date: Sun Mar 14 18:16:45 2010
New Revision: 98525
URL: http://llvm.org/viewvc/llvm-project?rev=98525&view=rev
Log:
don't forget to close a FD on an error condition, found by
cppcheck, PR6617. Patch by Ettl Martin!
Modified:
llvm/trunk/lib/System/Unix/Program.inc
Modified: llvm/trunk/lib/System/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=98525&r1=98524&r2=98525&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Sun Mar 14 18:16:45 2010
@@ -113,8 +113,9 @@
}
// Install it as the requested FD
- if (-1 == dup2(InFD, FD)) {
+ if (dup2(InFD, FD) == -1) {
MakeErrMsg(ErrMsg, "Cannot dup2");
+ close(InFD);
return true;
}
close(InFD); // Close the original FD
More information about the llvm-commits
mailing list