From e45f2f4bf5b2df04cb800bbd40db489fbf37ccb3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 3 Aug 2006 17:33:32 +0200 Subject: [PATCH] Don't call close() for the same fd twice in arecord 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aplay/aplay.c b/aplay/aplay.c index e467f92..68fac64 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -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 -- 2.47.1