Do not die if cap_rights_limit reports ENOSYS

Reported by:	mmel
This commit is contained in:
Baptiste Daroussin 2017-03-13 15:34:21 +00:00
parent 7f5f84f08f
commit 78f6a0c14a

View File

@ -424,9 +424,11 @@ diffreg(char *file1, char *file2, int flags, int capsicum)
if (capsicum) {
cap_rights_init(&rights_ro, CAP_READ, CAP_FSTAT, CAP_SEEK);
if (cap_rights_limit(fileno(f1), &rights_ro) < 0)
if (cap_rights_limit(fileno(f1), &rights_ro) < 0
&& errno != ENOSYS)
err(2, "unable to limit rights on: %s", file1);
if (cap_rights_limit(fileno(f2), &rights_ro) < 0)
if (cap_rights_limit(fileno(f2), &rights_ro) < 0 &&
errno != ENOSYS)
err(2, "unable to limit rights on: %s", file2);
if (fileno(f1) == STDIN_FILENO || fileno(f2) == STDIN_FILENO) {
/* stding has already been limited */