[llvm-commits] [llvm] r48270 - /llvm/trunk/lib/System/DynamicLibrary.cpp

Chris Lattner sabre at nondot.org
Tue Mar 11 17:50:02 PDT 2008


Author: lattner
Date: Tue Mar 11 19:50:01 2008
New Revision: 48270

URL: http://llvm.org/viewvc/llvm-project?rev=48270&view=rev
Log:
This is a simple fix for getting error messages from dlerror in
LoadLibraryPermanently. The current code modifies the value of a pointer
that is passed by value, so the caller never gets the message.

Patch by Julien Lerouge!

Modified:
    llvm/trunk/lib/System/DynamicLibrary.cpp

Modified: llvm/trunk/lib/System/DynamicLibrary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/DynamicLibrary.cpp?rev=48270&r1=48269&r2=48270&view=diff

==============================================================================
--- llvm/trunk/lib/System/DynamicLibrary.cpp (original)
+++ llvm/trunk/lib/System/DynamicLibrary.cpp Tue Mar 11 19:50:01 2008
@@ -63,7 +63,8 @@
                                             std::string *ErrMsg) {
   void *H = dlopen(Filename, RTLD_LAZY);
   if (H == 0) {
-    ErrMsg = new std::string(dlerror());
+    if (ErrMsg)
+      *ErrMsg = dlerror();
     return true;
   }
   OpenedHandles.push_back(H);





More information about the llvm-commits mailing list