virsh: Report an error when virGetUserDirectory fails

Otherwise virsh shows the interactive greeting and then silently exists
instead of entering interactive mode.
This commit is contained in:
Matthias Bolte 2011-05-15 07:31:42 +02:00
parent 1d8bcb45ca
commit 33a5f8ca82

View File

@ -12624,8 +12624,10 @@ vshReadlineInit(vshControl *ctl)
/* Prepare to read/write history from/to the ~/.virsh/history file */
userdir = virGetUserDirectory(getuid());
if (userdir == NULL)
if (userdir == NULL) {
vshError(ctl, "%s", _("Could not determine home directory"));
return -1;
}
if (virAsprintf(&ctl->historydir, "%s/.virsh", userdir) < 0) {
vshError(ctl, "%s", _("Out of memory"));