[alsa-devel] [PATCH v2] aplay: Fix error message when writing captured data
    Daniel Baluta 
    daniel.baluta at gmail.com
       
    Fri Apr  7 15:45:42 CEST 2017
    
    
  
On Fri, Apr 7, 2017 at 4:27 PM, Takashi Iwai <tiwai at suse.de> wrote:
> On Fri, 07 Apr 2017 15:20:36 +0200,
> Daniel Baluta wrote:
>>
>> Read can return less then requested bytes, but we treat
>> this as an error.
>
s/read/write here :)).
> Actually that's the bug -- we should loop the write until it reaches
> to the real error.  Once when we get the proper errno, the error
> message via perror() itself will be enough.
Correct. But I think aplay decided to keep things simple and fail in case
couldn't write all requested bytes.
This pattern can be noticed all over the places where write is used.
Given the fact that write is blocking (meaning that it must write
at least one byte until return) this should work most of the time,
excepting corner cases like disk full, etc.
thanks,
Daniel.
    
    
More information about the Alsa-devel
mailing list