mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-14 17:35:43 +01:00
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.
This commit is contained in:
parent
3de280c6f4
commit
e45f2f4bf5
1 changed files with 6 additions and 2 deletions
|
@ -309,8 +309,10 @@ static void signal_handler(int sig)
|
||||||
if (!quiet_mode)
|
if (!quiet_mode)
|
||||||
fprintf(stderr, _("Aborted by signal %s...\n"), strsignal(sig));
|
fprintf(stderr, _("Aborted by signal %s...\n"), strsignal(sig));
|
||||||
if (stream == SND_PCM_STREAM_CAPTURE) {
|
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);
|
fmt_rec_table[file_type].end(fd);
|
||||||
|
fd = -1;
|
||||||
|
}
|
||||||
stream = -1;
|
stream = -1;
|
||||||
}
|
}
|
||||||
if (fd > 1) {
|
if (fd > 1) {
|
||||||
|
@ -2169,8 +2171,10 @@ static void capture(char *orig_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* finish sample container */
|
/* 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);
|
fmt_rec_table[file_type].end(fd);
|
||||||
|
fd = -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* repeat the loop when format is raw without timelimit or
|
/* repeat the loop when format is raw without timelimit or
|
||||||
* requested counts of data are recorded
|
* requested counts of data are recorded
|
||||||
|
|
Loading…
Reference in a new issue