SELinuxProject / selinux

This is the upstream repository for the Security Enhanced Linux (SELinux) userland libraries and tools. The software provided by this project complements the SELinux features integrated into the Linux kernel and is used by Linux distributions. All bugs and patches should be submitted to selinux@vger.kernel.org
Other
1.35k stars 360 forks source link

setfiles.c:294:47: error: ‘SELINUX_RESTORECON_COUNT_ERRORS’ undeclared #368

Open dilyanpalauzov opened 2 years ago

dilyanpalauzov commented 2 years ago

Compiling selinux 3.4 prints:

make[2]: Entering directory '/src/selinux/selinux-3.4/policycoreutils/setfiles'
cc -O2 -Werror -Wall -Wextra -Wfloat-equal -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnull-dereference -Wpointer-arith -Wshadow -Wstrict-prototypes -Wundef -Wunused -Wwrite-strings -fno-common   -c -o setfiles.o setfiles.c
setfiles.c: In function ‘main’:
setfiles.c:294:47: error: ‘SELINUX_RESTORECON_COUNT_ERRORS’ undeclared (first use in this function); did you mean ‘SELINUX_RESTORECON_CONFLICT_ERROR’?
  294 |                         r_opts.count_errors = SELINUX_RESTORECON_COUNT_ERRORS;
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                               SELINUX_RESTORECON_CONFLICT_ERROR
setfiles.c:294:47: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [<builtin>: setfiles.o] Error 1
make[2]: Leaving directory '/src/selinux/selinux-3.4/policycoreutils/setfiles'

SELINUX_RESTORECON_COUNT_ERRORS is defined in the bundled libselinux/include/selinux/restorecon.h, but not in /usr/include/selinux/restorecon.h. The latter is from a previous version of selinux (probably 3.3).

The build command does not contain -I and then the path to the bundled include files. Therefore during build restorecon.h from a previous version of selinux are used.