forked from pool/alsa-utils
00b6532313
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=f8742572cdd457612a5394a3f2e4416c
76 lines
2.0 KiB
Diff
76 lines
2.0 KiB
Diff
From 73c79ebf26a51a2d9b582a4cae82867873875743 Mon Sep 17 00:00:00 2001
|
|
From: Jaroslav Kysela <perex@perex.cz>
|
|
Date: Thu, 15 Jul 2010 13:39:14 +0200
|
|
Subject: [PATCH 08/13] aplay: fix termio settings - return back old c_flag value on exit
|
|
|
|
- symptom - ssh client password authentication does not work with
|
|
the modified terminal settings
|
|
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
aplay/aplay.c | 18 +++++++++++++++++-
|
|
1 files changed, 17 insertions(+), 1 deletions(-)
|
|
|
|
diff --git a/aplay/aplay.c b/aplay/aplay.c
|
|
index b5203a7..a92ca93 100644
|
|
--- a/aplay/aplay.c
|
|
+++ b/aplay/aplay.c
|
|
@@ -117,6 +117,7 @@ static long long max_file_size = 0;
|
|
static int max_file_time = 0;
|
|
static int use_strftime = 0;
|
|
volatile static int recycle_capture_file = 0;
|
|
+static long term_c_lflag = 0;
|
|
|
|
static int fd = -1;
|
|
static off64_t pbrec_count = LLONG_MAX, fdcount;
|
|
@@ -128,6 +129,8 @@ static int pidfile_written = 0;
|
|
|
|
/* needed prototypes */
|
|
|
|
+static void done_stdin(void);
|
|
+
|
|
static void playback(char *filename);
|
|
static void capture(char *filename);
|
|
static void playbackv(char **filenames, unsigned int count);
|
|
@@ -343,6 +346,7 @@ static void version(void)
|
|
*/
|
|
static void prg_exit(int code)
|
|
{
|
|
+ done_stdin();
|
|
if (handle)
|
|
snd_pcm_close(handle);
|
|
if (pidfile_written)
|
|
@@ -1202,16 +1206,28 @@ static void init_stdin(void)
|
|
struct termios term;
|
|
long flags;
|
|
|
|
+ tcgetattr(fileno(stdin), &term);
|
|
+ term_c_lflag = term.c_lflag;
|
|
if (fd == fileno(stdin))
|
|
return;
|
|
flags = fcntl(fileno(stdin), F_GETFL);
|
|
if (flags < 0 || fcntl(fileno(stdin), F_SETFL, flags|O_NONBLOCK) < 0)
|
|
fprintf(stderr, _("stdin O_NONBLOCK flag setup failed\n"));
|
|
- tcgetattr(fileno(stdin), &term);
|
|
term.c_lflag &= ~ICANON;
|
|
tcsetattr(fileno(stdin), TCSANOW, &term);
|
|
}
|
|
|
|
+static void done_stdin(void)
|
|
+{
|
|
+ struct termios term;
|
|
+
|
|
+ if (fd == fileno(stdin))
|
|
+ return;
|
|
+ tcgetattr(fileno(stdin), &term);
|
|
+ term.c_lflag = term_c_lflag;
|
|
+ tcsetattr(fileno(stdin), TCSANOW, &term);
|
|
+}
|
|
+
|
|
static void do_pause(void)
|
|
{
|
|
int err;
|
|
--
|
|
1.7.2.1
|
|
|