Richard W.M. Jones
2010-Oct-18 12:00 UTC
[Libguestfs] [PATCH] parted: Don't return "loop" for non-partitioned devices (RHBZ#634246).
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html -------------- next part -------------->From b3d27793f04ae44b2c11f6422a19b4422ac941cd Mon Sep 17 00:00:00 2001From: Richard W.M. Jones <rjones at redhat.com> 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 files changed, 15 insertions(+), 0 deletions(-) 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.7.3.1
Apparently Analagous Threads
- [PATCH] daemon: Parse output of old parted which didn't support -m option (RHBZ#598309).
- [PATCH] fish: help command return error for non-existent commands (RHBZ#597145).
- [PATCH] Don't run new-kernel-pkg or nscd (RHBZ#557262).
- [PATCH] fish: Don't fail if -m and --listen flags are both given (RHBZ#612178).
- [PATCH] Add waitpid along guestfs_close path (RHBZ#518747)