summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Richter <frank.richter@gmail.com>2016-10-18 12:36:23 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2018-01-18 07:52:43 +0000
commit1aae404a4cf7f92d4135c1b24a3b6efef6c54708 (patch)
treedc6a0be0bd3e353579efc420ce85cb82c132192e
parenta57585961823cfc4d9a20ffd5dde3520c9229d61 (diff)
QProcess/Windows: Include PID in pipe names
Although qt_create_pipe() tries again if the pipe name is already in use, it doesn't handle the case when another user has created the pipe with the name (the error is "access denied" in that case). The chance that it happens is small, but it can be entirely eliminated by including a unique part in the pipe name, in this case the PID. [ChangeLog][Windows] Named pipes internally created by QProcess now contain the PID in their name to ensure uniqueness. Change-Id: I079f1b68695c1ddea3eccad241061d11e08b60f4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r--src/corelib/io/qprocess_win.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 05c9d6594c..fa9efcb1ce 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -102,7 +102,7 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
// ### The user must make sure to call qsrand() to make the pipe names less predictable.
// ### Replace the call to qrand() with a secure version, once we have it in Qt.
_snwprintf(pipeName, sizeof(pipeName) / sizeof(pipeName[0]),
- L"\\\\.\\pipe\\qt-%X", qrand());
+ L"\\\\.\\pipe\\qt-%lX-%X", long(QCoreApplication::applicationPid()), qrand());
DWORD dwOpenMode = FILE_FLAG_OVERLAPPED;
DWORD dwOutputBufferSize = 0;