[git commit] fdisk: fix CONFIG_FEATURE_SUN_LABEL=y build

Denys Vlasenko vda.linux at googlemail.com
Sat Sep 17 19:05:06 UTC 2016


commit: https://git.busybox.net/busybox/commit/?id=b157eb13cbc55338a3b82343c1cb2960af82cd17
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 util-linux/fdisk.c | 72 +++++++++++++++++++++++++++---------------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index a048dd9..32a66d0 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -473,6 +473,42 @@ close_dev_fd(void)
 	xmove_fd(xopen(bb_dev_null, O_RDONLY), dev_fd);
 }
 
+/* Return partition name */
+static const char *
+partname(const char *dev, int pno, int lth)
+{
+	const char *p;
+	int w, wp;
+	int bufsiz;
+	char *bufp;
+
+	bufp = auto_string(xzalloc(80));
+	bufsiz = 80;
+
+	w = strlen(dev);
+	p = "";
+
+	if (isdigit(dev[w-1]))
+		p = "p";
+
+	/* devfs kludge - note: fdisk partition names are not supposed
+	   to equal kernel names, so there is no reason to do this */
+	if (strcmp(dev + w - 4, "disc") == 0) {
+		w -= 4;
+		p = "part";
+	}
+
+	wp = strlen(p);
+
+	if (lth) {
+		snprintf(bufp, bufsiz, "%*.*s%s%-2u",
+			lth-wp-2, w, dev, p, pno);
+	} else {
+		snprintf(bufp, bufsiz, "%.*s%s%-2u", w, dev, p, pno);
+	}
+	return bufp;
+}
+
 static ALWAYS_INLINE struct partition *
 get_part_table(int i)
 {
@@ -2057,42 +2093,6 @@ fix_partition_table_order(void)
 }
 #endif
 
-/* Return partition name */
-static const char *
-partname(const char *dev, int pno, int lth)
-{
-	const char *p;
-	int w, wp;
-	int bufsiz;
-	char *bufp;
-
-	bufp = auto_string(xzalloc(80));
-	bufsiz = 80;
-
-	w = strlen(dev);
-	p = "";
-
-	if (isdigit(dev[w-1]))
-		p = "p";
-
-	/* devfs kludge - note: fdisk partition names are not supposed
-	   to equal kernel names, so there is no reason to do this */
-	if (strcmp(dev + w - 4, "disc") == 0) {
-		w -= 4;
-		p = "part";
-	}
-
-	wp = strlen(p);
-
-	if (lth) {
-		snprintf(bufp, bufsiz, "%*.*s%s%-2u",
-			lth-wp-2, w, dev, p, pno);
-	} else {
-		snprintf(bufp, bufsiz, "%.*s%s%-2u", w, dev, p, pno);
-	}
-	return bufp;
-}
-
 static const char *
 chs_string11(unsigned cyl, unsigned head, unsigned sect)
 {


More information about the busybox-cvs mailing list