Mercurial > illumos > illumos-gate
changeset 10908:20912677f009
6894772 GParted: Assertion (num >= 1 && num <= 4) failure in libparted
6896039 Directory usr/include/parted has the wrong permissions in the proto area
author | Mark Logan <Mark.Logan@Sun.COM> |
---|---|
date | Thu, 29 Oct 2009 13:12:37 -0700 |
parents | 881ceecbca49 |
children | 11fc80bc5cb9 |
files | usr/src/lib/libparted/Makefile usr/src/lib/libparted/common/libparted/arch/solaris.c |
diffstat | 2 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/libparted/Makefile Thu Oct 29 09:48:49 2009 -0700 +++ b/usr/src/lib/libparted/Makefile Thu Oct 29 13:12:37 2009 -0700 @@ -70,7 +70,7 @@ install_h: $(ROOTHDRDIR) $(ROOTHDRS) $(ROOTHDRDIR): - mkdir -p $@ + $(INS.dir) # # This open source is exempt from check
--- a/usr/src/lib/libparted/common/libparted/arch/solaris.c Thu Oct 29 09:48:49 2009 -0700 +++ b/usr/src/lib/libparted/common/libparted/arch/solaris.c Thu Oct 29 13:12:37 2009 -0700 @@ -304,6 +304,11 @@ ped_free(dev); } +/* + * This function constructs the Solaris device name for + * partition num on a disk given the *p0 device for that disk. + * For example: partition 2 of /dev/dsk/c0d0p0 becomes /dev/dsk/c0d0p2. + */ static char * _device_get_part_path(PedDevice* dev, int num) { @@ -312,23 +317,20 @@ char *result; PED_ASSERT(dev != NULL, return (NULL)); - PED_ASSERT(num >= 1 && num <= 4, return (NULL)); + PED_ASSERT(num >= 1, return (NULL)); result = (char *)ped_malloc(result_len); if (!result) return (NULL); - /* - * Create the path name to the *pn device, where n is the partition # - * geom->dev->path looks like this: "/devices/.../cmdk@0,0:q" - * or like this: "/dev/dsk/...p0" - * ":q" is the "/dev/dsk/...p0" device - * :r is p1, :s is p2, :t is p3, :u is p4 - * 'q' + 1 == 'r' - * '0' + 1 == '1' - */ strncpy(result, dev->path, result_len); - result[strlen(result) -1] += num; + if (path_len > 10 && result[path_len - 2] == 'p' && + result[path_len - 1] == '0') { + (void) snprintf(result + path_len - 1, + result_len - path_len + 1, "%d", num); + } else { + (void) snprintf(result, result_len, "partition %d", num); + } return (result); }