]> git.alsa-project.org Git - alsa-utils.git/commitdiff
Don't call close() for the same fd twice in arecord
authorTakashi Iwai <tiwai@suse.de>
Thu, 3 Aug 2006 15:33:32 +0000 (17:33 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 3 Aug 2006 15:33:32 +0000 (17:33 +0200)
Since fmt_rec_table[].end() closes the file descriptor, we should
reset fd to -1 for avoiding closing the same fd once again.

aplay/aplay.c

index e467f92968a70d6f7468268007c5080603486e39..68fac6449730cf88f643b1cad910ba453a45e7da 100644 (file)
@@ -309,8 +309,10 @@ static void signal_handler(int sig)
        if (!quiet_mode)
                fprintf(stderr, _("Aborted by signal %s...\n"), strsignal(sig));
        if (stream == SND_PCM_STREAM_CAPTURE) {
-               if (fmt_rec_table[file_type].end)
+               if (fmt_rec_table[file_type].end) {
                        fmt_rec_table[file_type].end(fd);
+                       fd = -1;
+               }
                stream = -1;
        }
        if (fd > 1) {
@@ -2169,8 +2171,10 @@ static void capture(char *orig_name)
                }
 
                /* finish sample container */
-               if (fmt_rec_table[file_type].end && !tostdout)
+               if (fmt_rec_table[file_type].end && !tostdout) {
                        fmt_rec_table[file_type].end(fd);
+                       fd = -1;
+               }
 
                /* repeat the loop when format is raw without timelimit or
                 * requested counts of data are recorded