diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2023-03-16 23:11:47 +0100 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2023-03-17 00:12:18 +0100 |
commit | f346fc01445b7192bb129ee12bd505d3ae07d777 (patch) | |
tree | 9be5cfae59ccf8cc297970a904090d8d685426d1 | |
parent | 1d03781daa034b77f82c1dac7c0095ce65b1cb63 (diff) | |
download | coreutils-f346fc01445b7192bb129ee12bd505d3ae07d777.tar.gz |
maint: avoid discarded-qualifiers warnings with SELinux 3.5
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.
-rw-r--r-- | src/selinux.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/selinux.c b/src/selinux.c index 2bd91d071..d56010bba 100644 --- a/src/selinux.c +++ b/src/selinux.c @@ -115,7 +115,7 @@ defaultcon (struct selabel_handle *selabel_handle, 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)) @@ -183,7 +183,7 @@ restorecon_private (struct selabel_handle *selabel_handle, char const *path) char *tcon = NULL; context_t scontext = 0, tcontext = 0; char const *contype; - char *constr; + char const *constr; int fd; if (!selabel_handle) |