1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

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 05f530f4d2)
(cherry picked from commit dbf34bbb18)
This commit is contained in:
Ed Maste 2024-02-14 19:03:40 -05:00
parent 1abd98ecf9
commit 8a17cc127b

View File

@ -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");