Daniel Veillard f5edf7
--- src/qemu_conf.c.orig	2009-04-02 11:50:10.000000000 +0200
Daniel Veillard f5edf7
+++ src/qemu_conf.c	2009-04-03 17:46:59.000000000 +0200
Daniel Veillard f5edf7
@@ -779,6 +779,20 @@ int qemudBuildCommandLine(virConnectPtr 
Daniel P. Berrange a09fc2
     char domid[50];
Daniel P. Berrange a09fc2
     char *pidfile;
Daniel Veillard f5edf7
     const char *cpu = NULL;
Daniel P. Berrange a09fc2
+    int skipSound = 0;
Daniel P. Berrange a09fc2
+
Daniel P. Berrange a09fc2
+    if (driver->securityDriver &&
Daniel P. Berrange a09fc2
+        driver->securityDriver->name &&
Daniel P. Berrange a09fc2
+        STREQ(driver->securityDriver->name, "selinux") &&
Daniel P. Berrange b59e64
+        getuid() == 0) {
Daniel P. Berrange a09fc2
+        static int soundWarned = 0; 
Daniel P. Berrange a09fc2
+        skipSound = 1;
Daniel Veillard 6a7311
+        if (def->nsounds &&
Daniel P. Berrange a09fc2
+            !soundWarned) {
Daniel P. Berrange a09fc2
+            soundWarned = 1;
Daniel P. Berrange a09fc2
+            VIR_WARN0("Sound cards for VMs are disabled while SELinux security model is active");
Daniel P. Berrange a09fc2
+        }
Daniel P. Berrange a09fc2
+    }
Daniel P. Berrange a09fc2
 
Daniel P. Berrange a09fc2
     uname_normalize(&ut);
Daniel P. Berrange a09fc2
 
Daniel Veillard f5edf7
@@ -1425,7 +1439,8 @@ int qemudBuildCommandLine(virConnectPtr 
Daniel P. Berrange a09fc2
     }
Daniel P. Berrange a09fc2
 
Daniel P. Berrange a09fc2
     /* Add sound hardware */
Daniel Veillard 6a7311
-    if (def->nsounds) {
Daniel Veillard 6a7311
+    if (def->nsounds &&
Daniel P. Berrange a09fc2
+        !skipSound) {
Daniel P. Berrange a09fc2
         int size = 100;
Daniel P. Berrange a09fc2
         char *modstr;
Daniel P. Berrange a09fc2
         if (VIR_ALLOC_N(modstr, size+1) < 0)