From b3d27793f04ae44b2c11f6422a19b4422ac941cd Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 18 Oct 2010 12:56:54 +0100 Subject: [PATCH] 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. --- daemon/parted.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 */ } } -- 1.8.3.1