Since SELinux version 3.5, the return value of context_str(3) is
declared as const; see:
https://github.com/SELinuxProject/selinux/commit/
dd98fa322766
Therefore, GCC complains (here with -Werror):
src/selinux.c: In function 'defaultcon':
src/selinux.c:152:16: error: assignment discards 'const' qualifier \
from pointer target type [-Werror=discarded-qualifiers]
152 | if (!(constr = context_str (tcontext)))
| ^
src/selinux.c: In function 'restorecon_private':
src/selinux.c:252:16: error: assignment discards 'const' qualifier \
from pointer target type [-Werror=discarded-qualifiers]
252 | if (!(constr = context_str (tcontext)))
| ^
* src/selinux.c (defaultcon): Define CONSTR as const.
(restorecon_private): Likewise.
char *tcon = NULL;
context_t scontext = 0, tcontext = 0;
char const *contype;
- char *constr;
+ char const *constr;
char *newpath = NULL;
if (! IS_ABSOLUTE_FILE_NAME (path))
char *tcon = NULL;
context_t scontext = 0, tcontext = 0;
char const *contype;
- char *constr;
+ char const *constr;
int fd;
if (!selabel_handle)