git: 2b1d0c0087a9 - main - fileargs: fix double caching of the same file
Mariusz Zaborski
oshogbo at FreeBSD.org
Wed Apr 7 19:18:08 UTC 2021
The branch main has been updated by oshogbo:
URL: https://cgit.FreeBSD.org/src/commit/?id=2b1d0c0087a907fe9944b96c6313711865f9674a
commit 2b1d0c0087a907fe9944b96c6313711865f9674a
Author: Mariusz Zaborski <oshogbo at FreeBSD.org>
AuthorDate: 2021-04-07 19:12:52 +0000
Commit: Mariusz Zaborski <oshogbo at FreeBSD.org>
CommitDate: 2021-04-07 19:16:37 +0000
fileargs: fix double caching of the same file
In situations when the current file name wasn't the first element on
the list we were cleaning the current name too early.
This might cause us to pre-cache the same file twice.
---
lib/libcasper/services/cap_fileargs/cap_fileargs.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/libcasper/services/cap_fileargs/cap_fileargs.c b/lib/libcasper/services/cap_fileargs/cap_fileargs.c
index ecab23004fcf..64ec69698165 100644
--- a/lib/libcasper/services/cap_fileargs/cap_fileargs.c
+++ b/lib/libcasper/services/cap_fileargs/cap_fileargs.c
@@ -562,8 +562,12 @@ fileargs_add_cache(nvlist_t *nvlout, const nvlist_t *limits,
break;
}
- if (type != NV_TYPE_NULL || (current_name != NULL &&
- strcmp(fname, current_name) == 0)) {
+ if (type != NV_TYPE_NULL) {
+ i--;
+ continue;
+ }
+ if (current_name != NULL &&
+ strcmp(fname, current_name) == 0) {
current_name = NULL;
i--;
continue;
More information about the dev-commits-src-main
mailing list