提交 feea656d 编写于 作者: X xy0 提交者: LINGuanRen

iter_task:fix potential fd leak

上级 bf5d7312
...@@ -103,6 +103,9 @@ void iter_task(task_cb cb, void *data1, void *data2, int64_t exclude_tid) ...@@ -103,6 +103,9 @@ void iter_task(task_cb cb, void *data1, void *data2, int64_t exclude_tid)
char d_name[]; char d_name[];
}; };
int fd = ::open("/proc/self/task/", O_DIRECTORY | O_RDONLY); int fd = ::open("/proc/self/task/", O_DIRECTORY | O_RDONLY);
DEFER(
CLOSE(fd);
);
if (-1 == fd) { if (-1 == fd) {
} else { } else {
int tgid = getpid(); int tgid = getpid();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册