1 Star 0 Fork 76

gys/rpm

forked from src-openEuler/rpm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
rpm-fix-rpm-is-blocked-when-open-fifo-file.patch 980 Bytes
一键复制 编辑 原始数据 按行查看 历史
xujing 提交于 2023-02-02 10:49 . update version to 4.18.0
From 988df03f8a293f7aa1d6bb872b981c5dfc6493d9 Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Tue, 8 Nov 2022 10:36:36 +0800
Subject: [PATCH] rpm: fix rpm is blocked when open fifo file
---
lib/fsm.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/fsm.c b/lib/fsm.c
index c9ab3e1..c1c86b0 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -1137,8 +1137,13 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files,
if (!rc && fd == -1 && !S_ISLNK(fp->sb.st_mode)) {
/* Only follow safe symlinks, and never on temporary files */
- fd = fsmOpenat(di.dirfd, fp->fpath,
- fp->suffix ? AT_SYMLINK_NOFOLLOW : 0, 0);
+ int flags = fp->suffix ? AT_SYMLINK_NOFOLLOW : 0;
+
+ /* Open the FIFO file in O_RDWR mode to prevent process blocking */
+ if (S_ISFIFO(fp->sb.st_mode))
+ flags |= O_RDWR;
+
+ fd = fsmOpenat(di.dirfd, fp->fpath, flags, 0);
if (fd < 0)
rc = RPMERR_OPEN_FAILED;
}
--
2.27.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gys66/rpm.git
git@gitee.com:gys66/rpm.git
gys66
rpm
rpm
master

搜索帮助