]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: console: Use proper constructor
authorRoman Bolshakov <r.bolshakov@yadro.com>
Mon, 5 Aug 2019 16:03:45 +0000 (19:03 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 5 Aug 2019 17:39:44 +0000 (19:39 +0200)
"virsh console" on macOS cannot attach to a domain and it doesn't matter if
it's local or remote domain:
  $ ~ virsh console vm
  Connected to domain vm
  Escape character is ^]
  error: internal error: unable to wait on console condition

The error comes from pthread_cond_wait that fails with EINVAL. The mutex
in the parent is not initialized with pthread_mutex_init and it results
in silent failure of pthead_mutex_lock and the attach failure.

Fixes: 98361cc3b95 ("tools: console: make console virLockableObject")
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-console.c

index 826a4afcb200f3f1ac96de894c0b0ddced13762e..e16f841e5731efbefe8ec55368fabf7e5abe641c 100644 (file)
@@ -367,7 +367,7 @@ virConsoleNew(void)
     if (virConsoleInitialize() < 0)
         return NULL;
 
-    if (!(con = virObjectNew(virConsoleClass)))
+    if (!(con = virObjectLockableNew(virConsoleClass)))
         return NULL;
 
     if (virCondInit(&con->cond) < 0) {