summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-05-08 20:25:10 +0000
committerEnrico Granata <egranata@apple.com>2013-05-08 20:25:10 +0000
commite1432cfe4cee7483ce7b48fc50c3c9293b126ff5 (patch)
tree2ff657e8ad6e096056e5420d270e0f026f4fea75 /lldb/source/Interpreter/ScriptInterpreterPython.cpp
parent23f23f4b7a5a84688c63280115523a0109192b9c (diff)
downloadbcm5719-llvm-e1432cfe4cee7483ce7b48fc50c3c9293b126ff5.tar.gz
bcm5719-llvm-e1432cfe4cee7483ce7b48fc50c3c9293b126ff5.zip
Improvements to the package importing feature - test case will follow
llvm-svn: 181461
Diffstat (limited to 'lldb/source/Interpreter/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index 3206154224b..5a4fa625a0a 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -2602,13 +2602,23 @@ ScriptInterpreterPython::LoadScriptingModule (const char* pathname,
Locker::AcquireLock | (init_session ? Locker::InitSession : 0),
Locker::FreeAcquiredLock | (init_session ? Locker::TearDownSession : 0));
- if (target_file.GetFileType() == FileSpec::eFileTypeInvalid ||
- target_file.GetFileType() == FileSpec::eFileTypeUnknown ||
- target_file.GetFileType() == FileSpec::eFileTypeDirectory )
+ if (target_file.GetFileType() == FileSpec::eFileTypeDirectory)
{
- // if not a filename, try to just plain import
+ // for directories, just import
basename = pathname;
}
+ else if (target_file.GetFileType() == FileSpec::eFileTypeInvalid ||
+ target_file.GetFileType() == FileSpec::eFileTypeUnknown)
+ {
+ // if not a valid file of any sort, check if it might be a filename still
+ // dot can't be used but / and \ can, and if either is found, reject
+ if (strchr(pathname,'\\') || strchr(pathname,'/'))
+ {
+ error.SetErrorString("invalid pathname");
+ return false;
+ }
+ basename = pathname; // not a filename, probably a package of some sort, let it go through
+ }
else
{
const char* directory = target_file.GetDirectory().GetCString();
OpenPOWER on IntegriCloud