]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virsh: Report an error when virGetUserDirectory fails
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sun, 15 May 2011 05:31:42 +0000 (07:31 +0200)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Mon, 16 May 2011 16:40:04 +0000 (18:40 +0200)
Otherwise virsh shows the interactive greeting and then silently exists
instead of entering interactive mode.

tools/virsh.c

index e35637d0f635c275e2c91252c8962389a9c38f55..a38750ffc849a95bd3e68d6dc8e31edd39eaf3db 100644 (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"));