diff --git a/sbin/gpt/add.c b/sbin/gpt/add.c index abaaf7b3bb60..d443a6d01b70 100644 --- a/sbin/gpt/add.c +++ b/sbin/gpt/add.c @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $"); #endif #ifdef __RCSID -__RCSID("$NetBSD: add.c,v 1.29 2015/11/30 19:59:34 christos Exp $"); +__RCSID("$NetBSD: add.c,v 1.30 2015/12/01 02:03:55 christos Exp $"); #endif #include @@ -180,9 +180,8 @@ add(int fd) gpt_write(fd, lbt); gpt_write(fd, tpg); - printf("Partition %d added on %s: ", i + 1, device_arg); - printf("%s %" PRIu64 " %" PRIu64 "\n", type, map->map_start, - map->map_size); + gpt_msg("Partition %d added: %s %" PRIu64 " %" PRIu64 "\n", i + 1, + type, map->map_start, map->map_size); } int diff --git a/sbin/gpt/gpt.c b/sbin/gpt/gpt.c index 615da87870f2..43ececc87eae 100644 --- a/sbin/gpt/gpt.c +++ b/sbin/gpt/gpt.c @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $"); #endif #ifdef __RCSID -__RCSID("$NetBSD: gpt.c,v 1.47 2015/12/01 01:49:23 christos Exp $"); +__RCSID("$NetBSD: gpt.c,v 1.48 2015/12/01 02:03:55 christos Exp $"); #endif #include @@ -573,15 +573,22 @@ void gpt_close(int fd) { - if (modified && !nosync) { + if (!modified) + goto out; + + if (!nosync) { #ifdef DIOCMWEDGES int bits; if (ioctl(fd, DIOCMWEDGES, &bits) == -1) warn("Can't update wedge information"); + else + goto out; #endif } + gpt_msg("You need to run \"dkctl %s makewedges\"" + " for the changes to take effect\n", device_name); - /* XXX post processing? */ +out: close(fd); } @@ -589,6 +596,9 @@ void gpt_msg(const char *fmt, ...) { va_list ap; + + if (quiet) + return; printf("%s: ", device_name); va_start(ap, fmt); vprintf(fmt, ap); diff --git a/sbin/gpt/resize.c b/sbin/gpt/resize.c index 864d9777bc01..fceb6d41bd58 100644 --- a/sbin/gpt/resize.c +++ b/sbin/gpt/resize.c @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $"); #endif #ifdef __RCSID -__RCSID("$NetBSD: resize.c,v 1.13 2015/11/30 19:59:34 christos Exp $"); +__RCSID("$NetBSD: resize.c,v 1.14 2015/12/01 02:03:55 christos Exp $"); #endif #include @@ -166,8 +166,8 @@ resize(int fd) gpt_write(fd, lbt); gpt_write(fd, tpg); - printf("Partition %d resized on %s: ", entry, device_arg); - printf("%" PRIu64 " %" PRIu64 "\n", map->map_start, newsize); + gpt_msg("Partition %d resized: %" PRIu64 " %" PRIu64 "\n", entry, + map->map_start, newsize); } int