alsa-lib: Make sure SND_PCM_NO_xxx flags don't get lost when nonblocking mode is enabled
alsa-lib: Make sure SND_PCM_NO_xxx flags don't get lost when nonblocking mode is enabled

The plug PCM copies the 'mode' field from the slave PCM. If blocking mode is
enabled for the plug PCM the mode is subsequently overwritten with the original
requested 'mode'. If non-blocking mode is requested this does not happen.

Because the hw PCM synthesizes the 'mode' from the actual file descriptor flags
no SND_PCM_NO_xxx will ever be set for it. This has the effect that the 'mode'
of the plug PCM will also not include those flags anymore -- unless they are
overwritten as mentioned above. This basically means SND_PCM_NO_xxx is ignored
for plug:hw:4711 style device strings opened in non-blocking mode.

You can easily test this with "aplay --channels 7 --disable-channels -f S16_LE
-r 44100 -D plug:hw:0" on a device that cannot do 7 channels. Normally this
call should fail, however if you add "-N" to the command line this call will
succeed.

This patch simply copies the SND_PCM_NO_xxx flags back into the 'mode' field in
case we don't overwrite it with the original anyway.

Probably closes bug 3571 for good.

From: Lennart Poettering <66ba19f2f050aef20e95fea609db8dff57792bdd@0pointer.de>
Signed-off-by: Jaroslav Kysela <72edd5e1a572f82f059ccbb83c92b74d6cb051ff@perex.cz>

Distrotech/alsa-lib,Distrotech/alsa-lib,tiwai/alsa-lib,lgirdwood/alsa-lib,zedongchen/alsa-lib,lgirdwood/alsa-lib,takaswie/alsa-lib,lgirdwood/alsa-lib,mikelima/alsa-lib,mikelima/alsa-lib,gittup/alsa-lib,alsa-project/alsa-lib,mikelima/alsa-lib,lgirdwood/alsa-lib,zedongchen/alsa-lib,mengdonglin/alsa-lib,takaswie/alsa-lib,takaswie/alsa-lib,tiwai/alsa-lib,alsa-project/alsa-lib,Distrotech/alsa-lib,mikelima/alsa-lib,tiwai/alsa-lib,gittup/alsa-lib,zedongchen/alsa-lib,mengdonglin/alsa-lib,mengdonglin/alsa-lib,gittup/alsa-lib,zedongchen/alsa-lib,Distrotech/alsa-lib,zedongchen/alsa-lib,mengdonglin/alsa-lib,gittup/alsa-lib,alsa-project/alsa-lib,lgirdwood/alsa-lib,Distrotech/alsa-lib,alsa-project/alsa-lib,mengdonglin/alsa-lib,takaswie/alsa-lib,mikelima/alsa-lib,tiwai/alsa-lib,takaswie/alsa-lib