13 Star 1 Fork 29

src-openEuler/policycoreutils

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-restorecond-Set-GLib-IO-channels-to-nonblocking.patch 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
markeryang 提交于 2025-03-18 15:37 +08:00 . backport patches from upstream
From 271eb4fe449dc9fd233f7e8d577f1c2897a13e2f Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Thu, 24 Oct 2024 10:48:16 +0200
Subject: [PATCH] restorecond: Set GLib IO channels to nonblocking
Without nonblocking IO, g_io_channel_read_chars waits indefinitely for more
data without ever returning control to the event loop.
Set the IO channels to nonblocking to fix SIGTERM handling.
Signed-off-by: Fabian Vogt <fvogt@suse.de>
Acked-by: James Carter <jwcart2@gmail.com>
---
restorecond/user.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/restorecond/user.c b/restorecond/user.c
index 7188c22e3..25e70ae15 100644
--- a/restorecond/user.c
+++ b/restorecond/user.c
@@ -239,6 +239,7 @@ static int local_server(void) {
/* watch for stdin/terminal going away */
GIOChannel *in = g_io_channel_unix_new(0);
g_io_channel_set_encoding(in, NULL, NULL);
+ g_io_channel_set_flags(in, g_io_channel_get_flags(in) | G_IO_FLAG_NONBLOCK, NULL);
g_io_add_watch_full( in,
G_PRIORITY_HIGH,
G_IO_IN|G_IO_ERR|G_IO_HUP,
@@ -284,6 +285,7 @@ int server(int master_fd, const char *watch_file) {
GIOChannel *c = g_io_channel_unix_new(master_fd);
g_io_channel_set_encoding(c, NULL, NULL);
+ g_io_channel_set_flags(c, g_io_channel_get_flags(c) | G_IO_FLAG_NONBLOCK, NULL);
g_io_add_watch_full(c,
G_PRIORITY_HIGH,
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/policycoreutils.git
git@gitee.com:src-openeuler/policycoreutils.git
src-openeuler
policycoreutils
policycoreutils
master

搜索帮助