git: 8a17cc127bb0 - stable/13 - cat: fix cap_rights_init usage

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Fri, 22 Mar 2024 13:36:26 UTC
The branch stable/13 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=8a17cc127bb0a404d8f641926ad4a3cc42c482da

commit 8a17cc127bb0a404d8f641926ad4a3cc42c482da
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-02-15 00:03:40 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-03-22 13:35:44 +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
    
    (cherry picked from commit 05f530f4d2bb15fda3d258b3bd92d4515d9ef39f)
    (cherry picked from commit dbf34bbb188876551dcfec32fbbed2ba8ba24f12)
---
 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 0f36bce2098d..dc6e6417dc49 100644
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -154,7 +154,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");