mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Bug 434103 - winpty instance might get reused by another PTY
This commit is contained in:
parent
13626ab74c
commit
4d6b998597
3 changed files with 9 additions and 4 deletions
Binary file not shown.
Binary file not shown.
|
@ -1,8 +1,9 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
* Copyright (c) 2013, 2014 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Wind River Systems - initial API and implementation
|
||||
|
@ -54,6 +55,10 @@ JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster(JNIEnv *
|
|||
srand((unsigned int)time(NULL));
|
||||
master = rand();
|
||||
|
||||
/* Make sure masterFD does not exist */
|
||||
while (fd2pty.find(master) != fd2pty.end())
|
||||
master++;
|
||||
|
||||
sprintf(line, "winpty_%i", master);
|
||||
|
||||
/* Remember the winpty handle for the generated masterFD */
|
||||
|
|
Loading…
Add table
Reference in a new issue