mkswap: don't use deprecated security_context_t

libselinux >= 3.1 makes security_context_t type deprecated. Let's
ifdef it to avoid unwanted warnings.

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2020-12-14 15:44:59 +01:00
parent e522815027
commit ca6fcc1a89
1 changed files with 5 additions and 2 deletions

View File

@ -628,8 +628,11 @@ int main(int argc, char **argv)
#ifdef HAVE_LIBSELINUX
if (S_ISREG(ctl.devstat.st_mode) && is_selinux_enabled() > 0) {
security_context_t context_string;
security_context_t oldcontext;
# ifdef HAVE_SELINUX_CONTEXT_T
security_context_t context_string, oldcontext; /* deprecated */
# else
char *context_string, *oldcontext; /* since libselinux >= 3.1 */
# endif
context_t newcontext;
if (fgetfilecon(ctl.fd, &oldcontext) < 0) {