summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-11-30 16:52:48 +0000
committerRichard W.M. Jones <rjones@redhat.com>2010-11-30 16:52:48 +0000
commitfdc8805362c6fc587bb7985c5290362ad3094f4e (patch)
tree8aa1713385894e334aabd5258ea968457cd65537
parent8d28fe0ef284a2e786bc92b40fbb4620120de335 (diff)
downloadlibguestfs-fdc8805362c6fc587bb7985c5290362ad3094f4e.tar.gz
libguestfs-fdc8805362c6fc587bb7985c5290362ad3094f4e.tar.xz
libguestfs-fdc8805362c6fc587bb7985c5290362ad3094f4e.zip
df: Fix segfault when using virt-df -a filename
If 'filename' doesn't contain a '/' character then virt-df was calculating NULL as the basename and later segfaulting.
-rw-r--r--df/main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/df/main.c b/df/main.c
index 9565464b..55e5eaa8 100644
--- a/df/main.c
+++ b/df/main.c
@@ -279,6 +279,8 @@ main (int argc, char *argv[])
switch (drvs->type) {
case drv_a:
name = strrchr (drvs->a.filename, '/');
+ if (name == NULL)
+ name = drvs->a.filename;
break;
case drv_d:
name = drvs->d.guest;