1 Star 0 Fork 91

xuxinyu / systemd

forked from src-openEuler / systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-test-fix-file-descriptor-leak-in-test-psi-util.patch 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
From eb760f4875afd75c433961c0a9bf00b1883e5d35 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Tue, 22 Feb 2022 21:46:41 +0900
Subject: [PATCH] test: fix file descriptor leak in test-psi-util
Fixes an issue reported in #22576.
(cherry picked from commit be99883e131ef422f8278ec1d099520996a78bb0)
(cherry picked from commit 81d3e2abff5f4234e06ceb6590d0c9939d8d97b4)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/eb760f4875afd75c433961c0a9bf00b1883e5d35
---
src/test/test-psi-util.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/test/test-psi-util.c b/src/test/test-psi-util.c
index c636cf255b..026f6aa1ab 100644
--- a/src/test/test-psi-util.c
+++ b/src/test/test-psi-util.c
@@ -3,19 +3,22 @@
#include <linux/loadavg.h>
#include "alloc-util.h"
+#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "psi-util.h"
#include "tests.h"
+#include "tmpfile-util.h"
static void test_read_mem_pressure(void) {
_cleanup_(unlink_tempfilep) char path[] = "/tmp/pressurereadtestXXXXXX";
+ _cleanup_close_ int fd = -1;
ResourcePressure rp;
if (geteuid() != 0)
return (void) log_tests_skipped("not root");
- assert_se(mkstemp(path));
+ assert_se((fd = mkostemp_safe(path)) >= 0);
assert_se(read_resource_pressure("/verylikelynonexistentpath", PRESSURE_TYPE_SOME, &rp) < 0);
assert_se(read_resource_pressure(path, PRESSURE_TYPE_SOME, &rp) < 0);
--
2.33.0
1
https://gitee.com/xuiny/systemd.git
git@gitee.com:xuiny/systemd.git
xuiny
systemd
systemd
master

搜索帮助