[llvm-commits] CVS: llvm/lib/System/Unix/Path.cpp
Reid Spencer
reid at x10sys.com
Sat Sep 18 12:25:22 PDT 2004
Changes in directory llvm/lib/System/Unix:
Path.cpp updated: 1.7 -> 1.8
---
Log message:
Get rid of file descriptor leak in create_file.
---
Diffs of the changes: (+3 -1)
Index: llvm/lib/System/Unix/Path.cpp
diff -u llvm/lib/System/Unix/Path.cpp:1.7 llvm/lib/System/Unix/Path.cpp:1.8
--- llvm/lib/System/Unix/Path.cpp:1.7 Thu Sep 16 11:36:10 2004
+++ llvm/lib/System/Unix/Path.cpp Sat Sep 18 14:25:11 2004
@@ -377,8 +377,10 @@
if (!is_file()) return false;
// Create the file
- if (0 != creat(path.c_str(), S_IRUSR | S_IWUSR))
+ int fd = ::creat(path.c_str(), S_IRUSR | S_IWUSR);
+ if (fd < 0)
ThrowErrno(std::string(path.c_str()) + ": Can't create file");
+ ::close(fd);
return true;
}
More information about the llvm-commits
mailing list