1 Star 0 Fork 14

yeah_wang/python2

forked from src-openEuler/python2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0353-2.7-bpo-36186-Fix-linuxaudiodev.linux_audio_device-e.patch 1.65 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 23:14 +08:00 . Package init
From b2aefd77e1da438aed649d018d6aa504ec35eac8 Mon Sep 17 00:00:00 2001
From: stratakis <cstratak@redhat.com>
Date: Wed, 6 Mar 2019 15:11:56 +0100
Subject: [PATCH 353/362] [2.7] bpo-36186: Fix
linuxaudiodev.linux_audio_device() error handling (GH-12163)
Fix linuxaudiodev.linux_audio_device() error handling:
close the internal file descriptor if it fails to open the device.
---
Misc/NEWS.d/next/Library/2019-03-04-16-39-16.bpo-36186.Hqw1A_.rst | 1 +
Modules/linuxaudiodev.c | 2 ++
2 files changed, 3 insertions(+)
create mode 100644 Misc/NEWS.d/next/Library/2019-03-04-16-39-16.bpo-36186.Hqw1A_.rst
diff --git a/Misc/NEWS.d/next/Library/2019-03-04-16-39-16.bpo-36186.Hqw1A_.rst b/Misc/NEWS.d/next/Library/2019-03-04-16-39-16.bpo-36186.Hqw1A_.rst
new file mode 100644
index 0000000..a14d155
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-03-04-16-39-16.bpo-36186.Hqw1A_.rst
@@ -0,0 +1 @@
+Fix linuxaudiodev.linux_audio_device() error handling: close the internal file descriptor if it fails to open the device.
diff --git a/Modules/linuxaudiodev.c b/Modules/linuxaudiodev.c
index 7fe20ae..f5135d9 100644
--- a/Modules/linuxaudiodev.c
+++ b/Modules/linuxaudiodev.c
@@ -126,10 +126,12 @@ newladobject(PyObject *arg)
}
if (imode == O_WRONLY && ioctl(fd, SNDCTL_DSP_NONBLOCK, NULL) == -1) {
PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev);
+ close(fd);
return NULL;
}
if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) {
PyErr_SetFromErrnoWithFilename(LinuxAudioError, basedev);
+ close(fd);
return NULL;
}
/* Create and initialize the object */
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yeah_wang/python2.git
git@gitee.com:yeah_wang/python2.git
yeah_wang
python2
python2
master

搜索帮助

371d5123 14472233 46e8bd33 14472233