1 Star 0 Fork 71

hongjinghao/coreutils

forked from src-openEuler/coreutils 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-ls-avoid-triggering-automounts.patch 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
panxiaohe 提交于 2022-03-29 18:50 . backport patches from upstream
From 85c975df2c25bd799370b04bb294e568e001102f Mon Sep 17 00:00:00 2001
From: Rohan Sable <rsable@redhat.com>
Date: Mon, 7 Mar 2022 14:14:13 +0000
Subject: [PATCH] ls: avoid triggering automounts
statx() has different defaults wrt automounting
compared to stat() or lstat(), so explicitly
set the AT_NO_AUTOMOUNT flag to suppress that behavior,
and avoid unintended operations or potential errors.
* src/ls.c (do_statx): Pass AT_NO_AUTOMOUNT to avoid this behavior.
* NEWS: Mention the change in behavior.
Fixes https://bugs.gnu.org/54286
Signed-off-by: Rohan Sable <rsable@redhat.com>
---
src/ls.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ls.c b/src/ls.c
index 1930e4abbc..255789061b 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1177,7 +1177,7 @@ do_statx (int fd, char const *name, struct stat *st, int flags,
{
struct statx stx;
bool want_btime = mask & STATX_BTIME;
- int ret = statx (fd, name, flags, mask, &stx);
+ int ret = statx (fd, name, flags | AT_NO_AUTOMOUNT, mask, &stx);
if (ret >= 0)
{
statx_to_stat (&stx, st);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hongjinghao/coreutils.git
git@gitee.com:hongjinghao/coreutils.git
hongjinghao
coreutils
coreutils
master

搜索帮助