Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Apr 2021 19:18:08 GMT
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2b1d0c0087a9 - main - fileargs: fix double caching of the same file
Message-ID:  <202104071918.137JI83Y016265@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by oshogbo:

URL: https://cgit.FreeBSD.org/src/commit/?id=2b1d0c0087a907fe9944b96c6313711865f9674a

commit 2b1d0c0087a907fe9944b96c6313711865f9674a
Author:     Mariusz Zaborski <oshogbo@FreeBSD.org>
AuthorDate: 2021-04-07 19:12:52 +0000
Commit:     Mariusz Zaborski <oshogbo@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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104071918.137JI83Y016265>