summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-10-18 12:56:54 +0100
committerRichard W.M. Jones <rjones@redhat.com>2010-10-18 12:56:54 +0100
commitb3d27793f04ae44b2c11f6422a19b4422ac941cd (patch)
treebba8892372aa4082e91521effa3fbfc160bf250d
parent361c513dc3e013d2d7e902e3b309a4c37cf6ee0f (diff)
downloadlibguestfs-b3d27793f04ae44b2c11f6422a19b4422ac941cd.tar.gz
libguestfs-b3d27793f04ae44b2c11f6422a19b4422ac941cd.tar.xz
libguestfs-b3d27793f04ae44b2c11f6422a19b4422ac941cd.zip
parted: Don't return "loop" for non-partitioned devices (RHBZ#634246).
If you ran part-get-parttype command on a device which didn't contain a partition, it used to return the string "loop". This is an internal representation that parted uses. We should instead return an error because part-get-parttype makes no sense for devices which are not partitioned.
-rw-r--r--daemon/parted.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/daemon/parted.c b/daemon/parted.c
index 89cc0d69..068384ef 100644
--- a/daemon/parted.c
+++ b/daemon/parted.c
@@ -378,6 +378,14 @@ do_part_get_parttype (const char *device)
}
free_strings (lines);
+
+ /* If "loop" return an error (RHBZ#634246). */
+ if (STREQ (r, "loop")) {
+ free (r);
+ reply_with_error ("not a partitioned device");
+ return NULL;
+ }
+
return r;
}
else {
@@ -406,6 +414,13 @@ do_part_get_parttype (const char *device)
return NULL;
}
+ /* If "loop" return an error (RHBZ#634246). */
+ if (STREQ (p, "loop")) {
+ free (p);
+ reply_with_error ("not a partitioned device");
+ return NULL;
+ }
+
return p; /* caller frees */
}
}