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: 98361cc3b9 ("tools: console: make console virLockableObject")
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Roman Bolshakov 2019-08-05 19:03:45 +03:00 committed by Michal Privoznik
parent 9f02064277
commit 9fbf56855d

View 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) {