Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-alsa-utils: Commit

external/alsa-utils


Commit MetaInfo

Revisiónbc42704c96c02b138849be4af6c90b4755659b56 (tree)
Tiempo2019-03-13 01:36:11
AutorJaroslav Kysela <perex@pere...>
CommiterJaroslav Kysela

Log Message

aplay: fix the multiple open file descriptors for the raw capture

Signed-off-by: Jaroslav Kysela <perex@perex.cz>

Cambiar Resumen

Diferencia incremental

--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -2690,8 +2690,6 @@ static void end_voc(int fd)
26902690 bt.datalen_h = (u_char) ((cnt & 0xFF0000) >> 16);
26912691 if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
26922692 xwrite(fd, &bt, sizeof(VocBlockType));
2693- if (fd != 1)
2694- close(fd);
26952693 }
26962694
26972695 static void end_wave(int fd)
@@ -2712,8 +2710,6 @@ static void end_wave(int fd)
27122710 xwrite(fd, &rifflen, 4);
27132711 if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
27142712 xwrite(fd, &cd, sizeof(WaveChunkHeader));
2715- if (fd != 1)
2716- close(fd);
27172713 }
27182714
27192715 static void end_au(int fd)
@@ -2725,8 +2721,6 @@ static void end_au(int fd)
27252721 ah.data_size = fdcount > 0xffffffff ? 0xffffffff : BE_INT(fdcount);
27262722 if (lseek64(fd, length_seek, SEEK_SET) == length_seek)
27272723 xwrite(fd, &ah.data_size, sizeof(ah.data_size));
2728- if (fd != 1)
2729- close(fd);
27302724 }
27312725
27322726 static void header(int rtype, char *name)
@@ -2938,7 +2932,7 @@ static void playback(char *name)
29382932 break;
29392933 }
29402934
2941- if (fd != 0)
2935+ if (fd != fileno(stdin))
29422936 close(fd);
29432937 }
29442938
@@ -3151,7 +3145,7 @@ static void capture(char *orig_name)
31513145 if (!name || !strcmp(name, "-")) {
31523146 fd = fileno(stdout);
31533147 name = "stdout";
3154- tostdout=1;
3148+ tostdout = 1;
31553149 if (count > fmt_rec_table[file_type].max_filesize)
31563150 count = fmt_rec_table[file_type].max_filesize;
31573151 }
@@ -3159,7 +3153,7 @@ static void capture(char *orig_name)
31593153
31603154 do {
31613155 /* open a file to write */
3162- if(!tostdout) {
3156+ if (!tostdout) {
31633157 /* upon the second file we start the numbering scheme */
31643158 if (filecount || use_strftime) {
31653159 filecount = new_capture_file(orig_name, namebuf,
@@ -3218,8 +3212,10 @@ static void capture(char *orig_name)
32183212 }
32193213
32203214 /* finish sample container */
3221- if (fmt_rec_table[file_type].end && !tostdout) {
3222- fmt_rec_table[file_type].end(fd);
3215+ if (!tostdout) {
3216+ if (fmt_rec_table[file_type].end)
3217+ fmt_rec_table[file_type].end(fd);
3218+ close(fd);
32233219 fd = -1;
32243220 }
32253221
Show on old repository browser