Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kliger (λgeek) <alklig@microsoft.com>2021-08-31 02:17:56 +0300
committerGitHub <noreply@github.com>2021-08-31 02:17:56 +0300
commita1ada04a58a69c792e0bb37021e98b9c0b0dc686 (patch)
treea33e1ae4e09b404d0d409af96fadcc7db837e64d
parent3cf59ad33daa57120ec2d3ca97cfdff4c89ca372 (diff)
[2020-02][linux] Some pseudo-tty fixes (#21205)mono-6.12.0.152
* Ignore EINVAL errors on ioctl TIOCMGET/TIOCMSET so (#20219) pseudo-ttys are usable. (#20218) * Fix pseudo-ttys for kernel versions >= 5.13 (#21203) Co-authored-by: csanchezdll <csanchezdll@gmail.com>
-rw-r--r--support/serial.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/support/serial.c b/support/serial.c
index 74c54b0a21c..30542da9dd4 100644
--- a/support/serial.c
+++ b/support/serial.c
@@ -510,7 +510,15 @@ set_signal (int fd, MonoSerialSignal signal, gboolean value)
expected = get_signal_code (signal);
if (ioctl (fd, TIOCMGET, &signals) == -1)
- return -1;
+ {
+ /* Return successfully for pseudo-ttys.
+ * Linux kernels < 5.13 return EINVAL,
+ * but versions >=5.13 return ENOTTY. */
+ if (errno == EINVAL || errno == ENOTTY)
+ return 1;
+
+ return -1;
+ }
activated = (signals & expected) != 0;
if (activated == value) /* Already set */