Author: sylvestre
Date: Sat Sep 28 10:23:41 2013
New Revision: 191616

URL: http://llvm.org/viewvc/llvm-project?rev=191616&view=rev
Log:
* mktemp is insecure as it always creates or uses insecure temporary file.
Switch to mkstemp.

* Get and display the error message when an error occurs while creating the 
temporary file



Modified:
    
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp

Modified: 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=191616&r1=191615&r2=191616&view=diff
==============================================================================
--- 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp 
Sat Sep 28 10:23:41 2013
@@ -7,6 +7,7 @@
 //
 
//===----------------------------------------------------------------------===//
 
+#include <errno.h>
 
 #include "GDBRemoteCommunicationServer.h"
 #include "lldb/Core/StreamGDBRemote.h"
@@ -762,9 +763,9 @@ GDBRemoteCommunicationServer::Handle_qLa
         Error error;
         std::string hostname;
         char unix_socket_name[PATH_MAX] = "/tmp/XXXXXX";
-        if (::mktemp (unix_socket_name) == NULL)
+        if (::mkstemp (unix_socket_name) == -1)
         {
-            error.SetErrorString ("failed to make temporary path for a unix 
socket");
+            error.SetErrorStringWithFormat("failed to make temporary path for 
a unix socket with errno: %s", strerror(errno));
         }
         else
         {


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to