aplay: Fix error message when writing captured data
PATCH 1/1 aplay: Fix error message when writing captured data
Write can return less then requested bytes, but we treat this as an error.
Anyhow, errno is not updated in this case and we can end up with a confusing error message.
For example, when there is no room to write data into the output file we receive:
$ arecord -d 2000 -c 2 -r 192000 -f S16_LE -Dplughw:0,0 audio.wav Recording WAVE '/mnt/msc/audio.wav' : Signed 16 bit Little Endian, Rate 192000 Hz, Stereo audio.wav: No such file or directory
--- aplay/aplay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
aplay/aplay.c +1 -1
@@ -3079,7 +3079,7 @@ static void capture(char *orig_name)break ; }if (write (fd, audiobuf, c) != c) { -perror (name); +fprintf (stderr,"Couldn't write all data to %s\n" , name); in_aborting =1 ;break ; }
Signature · 1 line
2.7.4
Hi,
Quoted 24 lines · Daniel Baluta
Write can return less then requested bytes, but we treat this as an error.
Anyhow, errno is not updated in this case and we can end up with a confusing error message.
For example, when there is no room to write data into the output file we receive:
$ arecord -d 2000 -c 2 -r 192000 -f S16_LE -Dplughw:0,0 audio.wav Recording WAVE '/mnt/msc/audio.wav' : Signed 16 bit Little Endian, Rate 192000 Hz, Stereo audio.wav: No such file or directorySigned-off-by Daniel Baluta <[email protected]>--- aplay/aplay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)aplay/aplay.c +0
-0
aplay/aplay.c static void capture(char *orig_name) · line 3085
Quoted 8 lines
aplay/aplay.c +1
-1@@ -3079,7 +3079,7 @@ static void capture(char *orig_name)break ; }if (write (fd, audiobuf, c) != c) { -perror (name); +fprintf (stderr,"Couldn't write all data to %s\n" , name); in_aborting =1 ;break ; }
I agree with this change.
A small nitpicking. This utility supports i18n with gettext. Let us use gettext alias to the message?
$ cd alsa-utils/aplay
$ git grep fprintf\( | wc
57 387 3939
$ git grep fprintf\( | grep _\( | wc
37 260 2570Regards
Takashi Sakamoto
Quoted 44 lines · Takashi Sakamoto
Hi,
Quoted 34 lines · Daniel Baluta
Write can return less then requested bytes, but we treat this as an error.
Anyhow, errno is not updated in this case and we can end up with a confusing error message.
For example, when there is no room to write data into the output file we receive:
$ arecord -d 2000 -c 2 -r 192000 -f S16_LE -Dplughw:0,0 audio.wav Recording WAVE '/mnt/msc/audio.wav' : Signed 16 bit Little Endian, Rate 192000 Hz, Stereo audio.wav: No such file or directorySigned-off-by Daniel Baluta <[email protected]>---
aplay/aplay.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)aplay/aplay.c +1
-1@@ -3079,7 +3079,7 @@ static void capture(char *orig_name) break; } if (write(fd, audiobuf, c) != c) { -perror (name); + fprintf(stderr, "Couldn't write all data to %s\n", name); in_aborting = 1; break;Quoted 1 line
}
I agree with this change.
A small nitpicking. This utility supports i18n with gettext. Let us use
gettext alias to the message?
Quoted 7 lines
$ cd alsa-utils/aplay $ git grep fprintf\( | wc 57 387 3939 $ git grep fprintf\( | grep _\( | wc 37 260 2570
Sure, will send v2. I didn't know about the gettext alias. :)
Daniel.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel