mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0001-daemon-lib-Replace-deprecated-security_context_t-wit.patch

da373f
From a5e8afb4ed8576a1b3398add2ede49a1f90ad01a Mon Sep 17 00:00:00 2001
da373f
From: "Richard W.M. Jones" <rjones@redhat.com>
da373f
Date: Thu, 30 Jul 2020 13:57:45 +0100
da373f
Subject: [PATCH] daemon, lib: Replace deprecated security_context_t with char
da373f
 *.
da373f
da373f
This gives deprecation warnings.  It always was simply a char *, and
da373f
the recommendation upstream is to replace uses with char *:
da373f
da373f
https://github.com/SELinuxProject/selinux/commit/9eb9c9327563014ad6a807814e7975424642d5b9
da373f
(cherry picked from commit eb78e990ac5277a4282293f8787af871a1420b61)
da373f
---
da373f
 daemon/selinux.c     | 3 +--
da373f
 lib/launch-libvirt.c | 5 ++---
da373f
 2 files changed, 3 insertions(+), 5 deletions(-)
da373f
da373f
diff --git a/daemon/selinux.c b/daemon/selinux.c
da373f
index 1c1446d30..f4d839c19 100644
da373f
--- a/daemon/selinux.c
da373f
+++ b/daemon/selinux.c
da373f
@@ -63,8 +63,7 @@ char *
da373f
 do_getcon (void)
da373f
 {
da373f
 #if defined(HAVE_GETCON)
da373f
-  security_context_t context;
da373f
-  char *r;
da373f
+  char *context, *r;
da373f
 
da373f
   if (getcon (&context) == -1) {
da373f
     reply_with_perror ("getcon");
da373f
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
da373f
index bc5978cc4..4a47bbb29 100644
da373f
--- a/lib/launch-libvirt.c
da373f
+++ b/lib/launch-libvirt.c
da373f
@@ -288,8 +288,7 @@ create_cow_overlay_libvirt (guestfs_h *g, void *datav, struct drive *drv)
da373f
   if (data->selinux_imagelabel) {
da373f
     debug (g, "setting SELinux label on %s to %s",
da373f
            overlay, data->selinux_imagelabel);
da373f
-    if (setfilecon (overlay,
da373f
-                    (security_context_t) data->selinux_imagelabel) == -1)
da373f
+    if (setfilecon (overlay, data->selinux_imagelabel) == -1)
da373f
       selinux_warning (g, __func__, "setfilecon", overlay);
da373f
   }
da373f
 #endif
da373f
@@ -840,7 +839,7 @@ is_custom_hv (guestfs_h *g)
da373f
 static void
da373f
 set_socket_create_context (guestfs_h *g)
da373f
 {
da373f
-  security_context_t scon; /* this is actually a 'char *' */
da373f
+  char *scon;
da373f
   context_t con;
da373f
 
da373f
   if (getcon (&scon) == -1) {
da373f
-- 
da373f
2.18.4
da373f