From 608a7e6cc73157a1a20af4de23381e455399df0a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 12 Apr 2006 12:36:13 +0200 Subject: jack plugin closes stdin if jack is unavailable the jack plugin closes stdin if the pcm interfaces is opened but jack isn't running. Initializing the file descriptors to -1 fixes the problem. From: Mikael Magnusson --- jack/pcm_jack.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'jack') diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c index 31cf050..4350302 100644 --- a/jack/pcm_jack.c +++ b/jack/pcm_jack.c @@ -61,8 +61,10 @@ static void snd_pcm_jack_free(snd_pcm_jack_t *jack) free(jack->port_names[i]); free(jack->port_names); } - close(jack->fd); - close(jack->io.poll_fd); + if (jack->fd >= 0) + close(jack->fd); + if (jack->io.poll_fd >= 0) + close(jack->io.poll_fd); free(jack->areas); free(jack); } @@ -321,6 +323,9 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name, if (!jack) return -ENOMEM; + jack->fd = -1; + jack->io.poll_fd = -1; + err = parse_ports(jack, stream == SND_PCM_STREAM_PLAYBACK ? playback_conf : capture_conf); if (err) { -- cgit