From: Richard W.M. Jones Date: Mon, 18 Oct 2010 11:56:54 +0000 (+0100) Subject: parted: Don't return "loop" for non-partitioned devices (RHBZ#634246). X-Git-Tag: 1.5.22~6 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=b3d27793f04ae44b2c11f6422a19b4422ac941cd;p=libguestfs.git 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. --- diff --git a/daemon/parted.c b/daemon/parted.c index 89cc0d6..068384e 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 */ } }