2015-11-11 18:04:52 +01:00
|
|
|
Index: xen-4.6.0-testing/tools/console/client/main.c
|
2011-03-21 17:47:37 +01:00
|
|
|
===================================================================
|
2015-11-11 18:04:52 +01:00
|
|
|
--- xen-4.6.0-testing.orig/tools/console/client/main.c
|
|
|
|
+++ xen-4.6.0-testing/tools/console/client/main.c
|
|
|
|
@@ -99,6 +99,7 @@ static int get_pty_fd(struct xs_handle *
|
2011-03-21 17:47:37 +01:00
|
|
|
* Assumes there is already a watch set in the store for this path. */
|
|
|
|
{
|
|
|
|
struct timeval tv;
|
|
|
|
+ struct flock lock;
|
|
|
|
fd_set watch_fdset;
|
|
|
|
int xs_fd = xs_fileno(xs), pty_fd = -1;
|
|
|
|
int start, now;
|
2015-11-11 18:04:52 +01:00
|
|
|
@@ -122,6 +123,14 @@ static int get_pty_fd(struct xs_handle *
|
2014-01-02 20:09:07 +01:00
|
|
|
pty_fd = open(pty_path, O_RDWR | O_NOCTTY);
|
|
|
|
if (pty_fd == -1)
|
2014-04-10 08:04:31 +02:00
|
|
|
warn("Could not open tty `%s'", pty_path);
|
|
|
|
+ else {
|
|
|
|
+ memset(&lock, 0, sizeof(lock));
|
|
|
|
+ lock.l_type = F_WRLCK;
|
|
|
|
+ lock.l_whence = SEEK_SET;
|
|
|
|
+ if (fcntl(pty_fd, F_SETLK, &lock) != 0)
|
|
|
|
+ err(errno, "Could not lock tty '%s'",
|
|
|
|
+ pty_path);
|
|
|
|
+ }
|
2011-03-21 17:47:37 +01:00
|
|
|
}
|
2014-04-10 08:04:31 +02:00
|
|
|
free(pty_path);
|
2011-03-21 17:47:37 +01:00
|
|
|
}
|