8 Star 0 Fork 30

src-openEuler/krb5

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Do-not-reload-a-modified-profile-data-object.patch 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
yanshuai 提交于 2024-04-30 15:57 +08:00 . Do not reload a modified profile data object
From 9b2fb80ad24006784170875709a04dc79e03b401 Mon Sep 17 00:00:00 2001
From: Greg Hudson <ghudson@mit.edu>
Date: Tue, 16 Apr 2024 02:14:29 -0400
Subject: [PATCH] Do not reload a modified profile data object
The profile library normally attempts to reload a profile data tree if
the backing file has changed. Reloading a dirty profile object
discards any modifications made by the caller. If we assume that the
modifications are destined to be flushed back out to the backing file,
then there is no good answer--one or the other set of changes will be
lost. But the caller may have a different intended use for the
modified tree (profile_flush_to_file(), profile_flush_to_buffer(),
krb5_init_context_profile()), for which the caller's modifications may
be critical. Avoid discarding in-memory edits to ensure the
correctness of these use cases.
ticket: 9118
---
src/util/profile/prof_file.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c
index 79f9500..c051f14 100644
--- a/src/util/profile/prof_file.c
+++ b/src/util/profile/prof_file.c
@@ -274,8 +274,13 @@ errcode_t profile_update_file_data_locked(prf_data_t data, char **ret_modspec)
FILE *f;
int isdir = 0;
+ /* Don't reload if the backing file isn't a regular file. */
if ((data->flags & PROFILE_FILE_NO_RELOAD) && data->root != NULL)
return 0;
+ /* Don't reload a modified data object, as the modifications may be
+ * important for this object's use. */
+ if (data->flags & PROFILE_FILE_DIRTY)
+ return 0;
#ifdef HAVE_STAT
now = time(0);
@@ -331,7 +336,6 @@ errcode_t profile_update_file_data_locked(prf_data_t data, char **ret_modspec)
}
data->upd_serial++;
- data->flags &= ~PROFILE_FILE_DIRTY;
if (isdir) {
retval = profile_process_directory(data->filespec, &data->root);
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/krb5.git
git@gitee.com:src-openeuler/krb5.git
src-openeuler
krb5
krb5
master

搜索帮助

371d5123 14472233 46e8bd33 14472233