git: 05f530f4d2bb - main - cat: fix cap_rights_init usage
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 15 Feb 2024 00:38:47 UTC
The branch main has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=05f530f4d2bb15fda3d258b3bd92d4515d9ef39f
commit 05f530f4d2bb15fda3d258b3bd92d4515d9ef39f
Author: Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-02-15 00:03:40 +0000
Commit: Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-02-15 00:37:54 +0000
cat: fix cap_rights_init usage
Capability rights passed to cap_rights_* are not simple bitmaks and
cannot be ORed together in general (although it will work for certain
subsets of rights).
PR: 277057
Reported by: asomers, markj
---
bin/cat/cat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/cat/cat.c b/bin/cat/cat.c
index c3812c6d9ca4..5dceb1cad94b 100644
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -141,7 +141,7 @@ init_casper(int argc, char *argv[])
err(EXIT_FAILURE, "unable to create Casper");
fa = fileargs_cinit(casper, argc, argv, O_RDONLY, 0,
- cap_rights_init(&rights, CAP_READ | CAP_FSTAT | CAP_FCNTL | CAP_SEEK),
+ cap_rights_init(&rights, CAP_READ, CAP_FSTAT, CAP_FCNTL, CAP_SEEK),
FA_OPEN | FA_REALPATH);
if (fa == NULL)
err(EXIT_FAILURE, "unable to create fileargs");