]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
jack plugin closes stdin if jack is unavailable
authorTakashi Iwai <tiwai@suse.de>
Wed, 12 Apr 2006 10:36:13 +0000 (12:36 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 12 Apr 2006 10:36:13 +0000 (12:36 +0200)
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 <mikma264@gmail.com>

jack/pcm_jack.c

index 31cf0506655771b1806702f10180847fc9f9299c..43503029f2bd4debe3d87c67b590da354df8409e 100644 (file)
@@ -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) {