aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-09-17 21:05:06 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-09-17 21:05:06 +0200
commitb157eb13cbc55338a3b82343c1cb2960af82cd17 (patch)
treed1552afdf1a5712208921bb1ed21475511ba9110
parent7373759947ac54e9a9b3b1a26572cca5cdc9a0e6 (diff)
downloadbusybox-w32-b157eb13cbc55338a3b82343c1cb2960af82cd17.tar.gz
busybox-w32-b157eb13cbc55338a3b82343c1cb2960af82cd17.tar.bz2
busybox-w32-b157eb13cbc55338a3b82343c1cb2960af82cd17.zip
fdisk: fix CONFIG_FEATURE_SUN_LABEL=y build
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--util-linux/fdisk.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index a048dd93b..32a66d03d 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -473,6 +473,42 @@ close_dev_fd(void)
473 xmove_fd(xopen(bb_dev_null, O_RDONLY), dev_fd); 473 xmove_fd(xopen(bb_dev_null, O_RDONLY), dev_fd);
474} 474}
475 475
476/* Return partition name */
477static const char *
478partname(const char *dev, int pno, int lth)
479{
480 const char *p;
481 int w, wp;
482 int bufsiz;
483 char *bufp;
484
485 bufp = auto_string(xzalloc(80));
486 bufsiz = 80;
487
488 w = strlen(dev);
489 p = "";
490
491 if (isdigit(dev[w-1]))
492 p = "p";
493
494 /* devfs kludge - note: fdisk partition names are not supposed
495 to equal kernel names, so there is no reason to do this */
496 if (strcmp(dev + w - 4, "disc") == 0) {
497 w -= 4;
498 p = "part";
499 }
500
501 wp = strlen(p);
502
503 if (lth) {
504 snprintf(bufp, bufsiz, "%*.*s%s%-2u",
505 lth-wp-2, w, dev, p, pno);
506 } else {
507 snprintf(bufp, bufsiz, "%.*s%s%-2u", w, dev, p, pno);
508 }
509 return bufp;
510}
511
476static ALWAYS_INLINE struct partition * 512static ALWAYS_INLINE struct partition *
477get_part_table(int i) 513get_part_table(int i)
478{ 514{
@@ -2057,42 +2093,6 @@ fix_partition_table_order(void)
2057} 2093}
2058#endif 2094#endif
2059 2095
2060/* Return partition name */
2061static const char *
2062partname(const char *dev, int pno, int lth)
2063{
2064 const char *p;
2065 int w, wp;
2066 int bufsiz;
2067 char *bufp;
2068
2069 bufp = auto_string(xzalloc(80));
2070 bufsiz = 80;
2071
2072 w = strlen(dev);
2073 p = "";
2074
2075 if (isdigit(dev[w-1]))
2076 p = "p";
2077
2078 /* devfs kludge - note: fdisk partition names are not supposed
2079 to equal kernel names, so there is no reason to do this */
2080 if (strcmp(dev + w - 4, "disc") == 0) {
2081 w -= 4;
2082 p = "part";
2083 }
2084
2085 wp = strlen(p);
2086
2087 if (lth) {
2088 snprintf(bufp, bufsiz, "%*.*s%s%-2u",
2089 lth-wp-2, w, dev, p, pno);
2090 } else {
2091 snprintf(bufp, bufsiz, "%.*s%s%-2u", w, dev, p, pno);
2092 }
2093 return bufp;
2094}
2095
2096static const char * 2096static const char *
2097chs_string11(unsigned cyl, unsigned head, unsigned sect) 2097chs_string11(unsigned cyl, unsigned head, unsigned sect)
2098{ 2098{