[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ataraid-list
Subject:    Re: Ubuntu Patches [4/16]
From:       Phillip Susi <psusi () cfl ! rr ! com>
Date:       2011-03-19 17:50:23
Message-ID: 4D84ECDF.9050309 () cfl ! rr ! com
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Repost: formalized the description and cleaned up stylistic errors


["24_drop_p_for_partition_conditional.patch" (text/x-patch)]

From: Phillip Susi <psusi@cfl.rr.com>
Last-Update: 2011-03-08
Description: 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".
Forwarded: Yes

Index: b/1.0.0.rc16/lib/format/partition/dos.c
===================================================================
--- a/1.0.0.rc16/lib/format/partition/dos.c
+++ b/1.0.0.rc16/lib/format/partition/dos.c
@@ -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 *

["signature.asc" (application/pgp-signature)]

_______________________________________________
Ataraid-list mailing list
Ataraid-list@redhat.com
https://www.redhat.com/mailman/listinfo/ataraid-list

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic