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
This commit is contained in:
Ed Maste 2024-02-14 19:03:40 -05:00
parent d79b6b8ec2
commit 05f530f4d2

View File

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