aboutsummaryrefslogtreecommitdiffstats
path: root/main/sipp/fix-stdin.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-09-24 08:34:42 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2013-09-24 08:34:42 +0200
commit326109d8c7653579121de2b8737dfe487e5a436e (patch)
tree0df80729077c0481c51f94a3e99ad94a0b27fcaf /main/sipp/fix-stdin.patch
parent6462a531fde2fd520afaf6e14325e2ff416707fa (diff)
downloadaports-326109d8c7653579121de2b8737dfe487e5a436e.tar.bz2
aports-326109d8c7653579121de2b8737dfe487e5a436e.tar.xz
main/sipp: reset stdin on exit
fixes #2259 upstream: https://sourceforge.net/p/sipp/bugs/123/
Diffstat (limited to 'main/sipp/fix-stdin.patch')
-rw-r--r--main/sipp/fix-stdin.patch19
1 files changed, 19 insertions, 0 deletions
diff --git a/main/sipp/fix-stdin.patch b/main/sipp/fix-stdin.patch
new file mode 100644
index 0000000000..c420d5dceb
--- /dev/null
+++ b/main/sipp/fix-stdin.patch
@@ -0,0 +1,19 @@
+--- ./sipp.cpp.orig 2013-09-23 15:05:15.164194852 +0000
++++ ./sipp.cpp 2013-09-23 15:07:12.685491835 +0000
+@@ -1989,8 +1989,15 @@
+ }
+ }
+
++static int stdin_mode;
++void reset_stdin_socket() {
++ fcntl(fileno(stdin), F_SETFL, stdin_mode);
++}
++
+ void setup_stdin_socket() {
+- fcntl(fileno(stdin), F_SETFL, fcntl(fileno(stdin), F_GETFL) | O_NONBLOCK);
++ stdin_mode = fcntl(fileno(stdin), F_GETFL);
++ atexit(reset_stdin_socket);
++ fcntl(fileno(stdin), F_SETFL, stdin_mode | O_NONBLOCK);
+ stdin_socket = sipp_allocate_socket(0, T_UDP, fileno(stdin), 0);
+ if (!stdin_socket) {
+ ERROR_NO("Could not setup keyboard (stdin) socket!\n");