diff options
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/boot/Makefile.version | 2 | ||||
| -rw-r--r-- | usr/src/boot/lib/libstand/printf.c | 41 | ||||
| -rw-r--r-- | usr/src/boot/lib/libstand/stand.h | 1 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/common/multiboot2.c | 14 | ||||
| -rw-r--r-- | usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c | 3 |
5 files changed, 48 insertions, 13 deletions
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index c8dbaf6b00..132d1eb155 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2017.4.23.1 +BOOT_VERSION = $(LOADER_VERSION)-2017.4.23.2 diff --git a/usr/src/boot/lib/libstand/printf.c b/usr/src/boot/lib/libstand/printf.c index c3e08a5b28..66d809abee 100644 --- a/usr/src/boot/lib/libstand/printf.c +++ b/usr/src/boot/lib/libstand/printf.c @@ -35,7 +35,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); /* * Standaloneified version of the FreeBSD kernel printf family. @@ -122,6 +121,34 @@ snprint_func(int ch, void *arg) } int +asprintf(char **buf, const char *cfmt, ...) +{ + int retval; + struct print_buf arg; + va_list ap; + + *buf = NULL; + va_start(ap, cfmt); + retval = kvprintf(cfmt, NULL, NULL, 10, ap); + va_end(ap); + if (retval <= 0) + return (-1); + + arg.size = retval + 1; + arg.buf = *buf = malloc(arg.size); + if (*buf == NULL) + return (-1); + + va_start(ap, cfmt); + retval = kvprintf(cfmt, &snprint_func, &arg, 10, ap); + va_end(ap); + + if (arg.size >= 1) + *(arg.buf)++ = 0; + return (retval); +} + +int snprintf(char *buf, size_t size, const char *cfmt, ...) { int retval; @@ -213,7 +240,17 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper) static int kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) { -#define PCHAR(c) {int cc=(c); if (func) (*func)(cc, arg); else *d++ = cc; retval++; } +#define PCHAR(c) { \ + int cc = (c); \ + \ + if (func) { \ + (*func)(cc, arg); \ + } else if (d != NULL) { \ + *d++ = cc; \ + } \ + retval++; \ + } + char nbuf[MAXNBUF]; char *d; const char *p, *percent, *q; diff --git a/usr/src/boot/lib/libstand/stand.h b/usr/src/boot/lib/libstand/stand.h index cd10db19c4..9a7e070bdc 100644 --- a/usr/src/boot/lib/libstand/stand.h +++ b/usr/src/boot/lib/libstand/stand.h @@ -261,6 +261,7 @@ extern void mallocstats(void); extern int printf(const char *fmt, ...) __printflike(1, 2); extern void vprintf(const char *fmt, __va_list); +extern int asprintf(char **buf, const char *cfmt, ...) __printflike(2, 3); extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); extern int snprintf(char *buf, size_t size, const char *cfmt, ...) __printflike(3, 4); extern void vsprintf(char *buf, const char *cfmt, __va_list); diff --git a/usr/src/boot/sys/boot/common/multiboot2.c b/usr/src/boot/sys/boot/common/multiboot2.c index adf1b7e2b4..fa9775ea32 100644 --- a/usr/src/boot/sys/boot/common/multiboot2.c +++ b/usr/src/boot/sys/boot/common/multiboot2.c @@ -852,19 +852,19 @@ multiboot2_exec(struct preloaded_file *fp) if (rsdp != NULL) { multiboot_tag_new_acpi_t *ntag; multiboot_tag_old_acpi_t *otag; - int size; + uint32_t tsize; if (rsdp->Revision == 0) { - size = sizeof (*otag) + rsdp->Length; - otag = (multiboot_tag_old_acpi_t *)mb_malloc(size); + tsize = sizeof (*otag) + sizeof (ACPI_RSDP_COMMON); + otag = (multiboot_tag_old_acpi_t *)mb_malloc(tsize); otag->mb_type = MULTIBOOT_TAG_TYPE_ACPI_OLD; - otag->mb_size = size; + otag->mb_size = tsize; memcpy(otag->mb_rsdp, rsdp, sizeof (ACPI_RSDP_COMMON)); } else { - size = sizeof (*ntag) + rsdp->Length; - ntag = (multiboot_tag_new_acpi_t *)mb_malloc(size); + tsize = sizeof (*ntag) + rsdp->Length; + ntag = (multiboot_tag_new_acpi_t *)mb_malloc(tsize); ntag->mb_type = MULTIBOOT_TAG_TYPE_ACPI_NEW; - ntag->mb_size = size; + ntag->mb_size = tsize; memcpy(ntag->mb_rsdp, rsdp, rsdp->Length); } } diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c index 0ee7f2c9bb..bc1c4da24a 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c +++ b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c @@ -508,9 +508,6 @@ parse_cmd(void) pager_open(); for (i = 0; devsw[i] != NULL; i++) { if (devsw[i]->dv_print != NULL) { - sprintf(line, "\n%s devices:\n", devsw[i]->dv_name); - if (pager_output(line)) - break; if (devsw[i]->dv_print(1)) break; } else { |
