hanchenye-llvm-project/lldb/source/Host/posix
Ilia K 686b1fe65a Fix FileSpec::GetPath to return null-terminated strings
Summary:
Before this fix the FileSpec::GetPath() returned string which might be without '\0' at the end.
It could have happened if the size of buffer for path was less than actual path.

Test case:
```
FileSpec test("/path/to/file", false);
char buf[]="!!!!!!";
test.GetPath(buf, 3);
```

Before fix:
```
   233          FileSpec test("/path/to/file", false);
   234          char buf[]="!!!!!!";
   235          test.GetPath(buf, 3);
   236
-> 237          if (core_file)
   238          {
   239              if (!core_file.Exists())
   240              {
(lldb) print buf
(char [7]) $0 = "/pa!!!"
```

After fix:
```
   233          FileSpec test("/path/to/file", false);
   234          char buf[]="!!!!!!";
   235          test.GetPath(buf, 3);
   236
-> 237          if (core_file)
   238          {
   239              if (!core_file.Exists())
   240              {
(lldb) print buf
(char [7]) $0 = "/p"
```

Reviewers: zturner, abidh, clayborg

Reviewed By: abidh, clayborg

Subscribers: tberghammer, vharron, lldb-commits, clayborg, zturner, abidh

Differential Revision: http://reviews.llvm.org/D7553

llvm-svn: 230787
2015-02-27 19:43:08 +00:00
..
ConnectionFileDescriptorPosix.cpp Added Connection::GetURI() 2015-01-17 02:20:29 +00:00
FileSystem.cpp Fix typo that breaks FileSystem::IsLocal 2015-02-24 05:24:12 +00:00
HostInfoPosix.cpp Fix FileSpec::GetPath to return null-terminated strings 2015-02-27 19:43:08 +00:00
HostProcessPosix.cpp Create a process launcher abstraction. 2014-10-14 21:55:08 +00:00
HostThreadPosix.cpp Fix being able to get a thread result when calling HostThreadPosix::Join(). It was broken when initially checked in by getting the thread result into a temporary variable and never doing anything with it. Most threads in LLDB don't look at their thread results, but launching processes in a terminal window on MacOSX does require getting a thread result and this broke "process launch --tty" on darwin. 2015-01-06 00:21:29 +00:00
Makefile
PipePosix.cpp Fix warning about the use of mktemp and make platform agnostic by adding and using PipeBase::CreateWithUniqueName - on behalf of flackr. 2015-02-05 16:29:12 +00:00
ProcessLauncherPosix.cpp Create a process launcher abstraction. 2014-10-14 21:55:08 +00:00