Re: Ubuntu Patches [4/16]
Phillip Susi <[email protected]> Fri, 04 Mar 2011 23:07:56 -0500
| Newsgroups | gmane.linux.ataraid |
|---|---|
| Message-ID | <[email protected]> |
_______________________________________________ Ataraid-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/ataraid-list
04_drop_p_for_partition_conditional.patch
(text/x-patch, 1.1 KB)
dmraid was changed at one point to insert a 'p' between the base device name and the partition number. For some time debian and ubuntu reversed this change. This patch modifies the behavior to add the 'p' iff the last character of the base name is a digit. This makes dmraid comply with the behavior used by kpartx and "by linux since the dawn of time". Phillip Susi <[email protected]> Index: dmraid/1.0.0.rc16/lib/format/partition/dos.c =================================================================== --- dmraid.orig/1.0.0.rc16/lib/format/partition/dos.c 2011-03-04 19:26:26.161474366 -0500 +++ dmraid/1.0.0.rc16/lib/format/partition/dos.c 2011-03-04 19:27:06.961474362 -0500 @@ -31,8 +31,14 @@ { const char *base = get_basename(lc, rd->di->path); - return type ? snprintf(str, len, "%s%s%u", base, OPT_STR_PARTCHAR(lc), - partition) : snprintf(str, len, "%s", base); + if (type) + { + if (isdigit(base[strlen(base)-1])) + return snprintf(str, len, "%s%s%u", base, + OPT_STR_PARTCHAR(lc), partition); + else return snprintf(str, len, "%s%u", base, partition); + } + else return snprintf(str, len, "%s", base); } static char *