summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2016-01-27 20:34:28 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2016-01-27 20:34:28 +0000
commit193b43f889a3d021cb93e1db9b8afb322f12d086 (patch)
treebd138125f588f2c3c9fc4b211b65f38307d0e829 /sbin
parentfdc7443155a90e9d84555aedb0752bff0a4936f2 (diff)
No need to copy dmpe_name to a buffer before printing it.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/pdisk/dump.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c
index 4e4c8608273..8085890fe32 100644
--- a/sbin/pdisk/dump.c
+++ b/sbin/pdisk/dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dump.c,v 1.59 2016/01/27 18:26:05 gsoares Exp $ */
+/* $OpenBSD: dump.c,v 1.60 2016/01/27 20:34:27 krw Exp $ */
/*
* dump.c - dumping partition maps
@@ -109,8 +109,7 @@ dump_partition_entry(struct partition_map *entry, int type_length,
int name_length, int digits)
{
struct partition_map_header *map;
- struct dpme *p;
- char *buf;
+ struct dpme *p;
double bytes;
int j, driver;
uint32_t size;
@@ -119,13 +118,7 @@ dump_partition_entry(struct partition_map *entry, int type_length,
p = entry->dpme;
driver = entry->contains_driver ? '*' : ' ';
printf("%2ld: %*.32s", entry->disk_address, type_length, p->dpme_type);
-
- buf = malloc(name_length + 1);
- if (buf == NULL)
- return;
- strlcpy(buf, p->dpme_name, name_length+1);
- printf("%c%-*.32s ", driver, name_length, buf);
- free(buf);
+ printf("%c%-*.32s ", driver, name_length, p->dpme_name);
if (p->dpme_lblocks + p->dpme_lblock_start != p->dpme_pblocks) {
printf("%*u+", digits, p->dpme_lblocks);