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>
This commit is contained in:
parent
a575859618
commit
1aae404a4c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user