Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d8d179d

Browse files
committed
main(): wrap the device.setinfo() call around an exception handler.
It's possible to get a sunaudiodev.error (errno == EINVAL), although I'm not exactly sure why, this at least won't crash the application.
1 parent da2d352 commit d8d179d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Tools/audiopy/audiopy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Other options are:
4848
import sys
4949
import os
5050
import string
51+
import errno
5152
import sunaudiodev
5253
from SUNAUDIODEV import *
5354

@@ -490,7 +491,12 @@ Version: %s''' % __version__
490491
else:
491492
usage(1, msg='Invalid option: ' + arg)
492493
# now set the values
493-
device.setinfo(info)
494+
try:
495+
device.setinfo(info)
496+
except sunaudiodev.error, (code, msg):
497+
if code == errno.EINVAL:
498+
pass
499+
raise
494500
device.close()
495501

496502

0 commit comments

Comments
 (0)