git: dbf34bbb1888 - stable/14 - cat: fix cap_rights_init usage

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

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

commit dbf34bbb188876551dcfec32fbbed2ba8ba24f12
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:30:32 +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)
---
 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 c69bbc4911cb..81ec5feec240 100644
--- a/bin/cat/cat.c
+++ b/bin/cat/cat.c
@@ -155,7 +155,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");