From: Roman Bolshakov Date: Mon, 5 Aug 2019 16:03:45 +0000 (+0300) Subject: tools: console: Use proper constructor X-Git-Tag: v5.7.0-rc1~412 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fbf56855d1e15eb058e073139b7b688c28460a3;p=thirdparty%2Flibvirt.git tools: console: Use proper constructor "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 Reviewed-by: Michal Privoznik --- diff --git a/tools/virsh-console.c b/tools/virsh-console.c index 826a4afcb2..e16f841e57 100644 --- a/tools/virsh-console.c +++ b/tools/virsh-console.c @@ -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) {