summaryrefslogtreecommitdiff
path: root/xenconsole-no-multiple-connections.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-10-12 04:00:49 +0000
committerCoprDistGit <infra@openeuler.org>2023-10-12 04:00:49 +0000
commitc22f60e6e55f1bf300dd76d2222a93911f3b2bb2 (patch)
treeef665e7018377f53612ac2751dcaea35a1c587b6 /xenconsole-no-multiple-connections.patch
parent39a4763249cd6289e5019acfe0c98dbb169f5f2e (diff)
automatic import of xenopeneuler22.03_LTS
Diffstat (limited to 'xenconsole-no-multiple-connections.patch')
-rw-r--r--xenconsole-no-multiple-connections.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/xenconsole-no-multiple-connections.patch b/xenconsole-no-multiple-connections.patch
new file mode 100644
index 0000000..89bb169
--- /dev/null
+++ b/xenconsole-no-multiple-connections.patch
@@ -0,0 +1,27 @@
+Index: xen-4.8.0-testing/tools/console/client/main.c
+===================================================================
+--- xen-4.8.0-testing.orig/tools/console/client/main.c
++++ xen-4.8.0-testing/tools/console/client/main.c
+@@ -101,6 +101,7 @@ static int get_pty_fd(struct xs_handle *
+ * 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;
+@@ -124,6 +125,14 @@ static int get_pty_fd(struct xs_handle *
+ pty_fd = open(pty_path, O_RDWR | O_NOCTTY);
+ if (pty_fd == -1)
+ 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);
++ }
+ }
+ free(pty_path);
+ }