]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkswap: don't use deprecated security_context_t
authorKarel Zak <kzak@redhat.com>
Mon, 14 Dec 2020 14:44:59 +0000 (15:44 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 14 Dec 2020 14:54:08 +0000 (15:54 +0100)
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>
disk-utils/mkswap.c

index be70617326ad12ef882deb56716c863caf858763..631e7028497f73d80c5905c08839736d901a6992 100644 (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) {