Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst Two more gcc 7 warnings when compiling wiht...
details: https://anonhg.NetBSD.org/src/rev/d5f22cabf4b2
branches: trunk
changeset: 448857:d5f22cabf4b2
user: martin <martin%NetBSD.org@localhost>
date: Mon Feb 11 19:58:22 2019 +0000
description:
Two more gcc 7 warnings when compiling wiht optimization on, one to go.
diffstat:
usr.sbin/sysinst/partman.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
diffs (50 lines):
diff -r b55496779610 -r d5f22cabf4b2 usr.sbin/sysinst/partman.c
--- a/usr.sbin/sysinst/partman.c Mon Feb 11 19:45:54 2019 +0000
+++ b/usr.sbin/sysinst/partman.c Mon Feb 11 19:58:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: partman.c,v 1.26 2019/02/11 19:15:38 martin Exp $ */
+/* $NetBSD: partman.c,v 1.27 2019/02/11 19:58:22 martin Exp $ */
/*
* Copyright 2012 Eugene Lozovoy
@@ -255,19 +255,24 @@
static void
pm_getdevstring(char *buf, int len, pm_devs_t *pm_cur, int num)
{
- int i;
+ int i, r;
if (pm_cur->isspecial)
snprintf(buf, len, "%s", pm_cur->diskdev);
- else if (num + 'a' < 'a' || num + 'a' > 'a' + MAXPARTITIONS)
- snprintf(buf, len, "%sd", pm_cur->diskdev);
- else if (pm_cur->gpt) {
+ else if (num + 'a' < 'a' || num + 'a' > 'a' + MAXPARTITIONS) {
+ r = snprintf(buf, len-1, "%sd", pm_cur->diskdev);
+ if (r >= len)
+ buf[len] = 0;
+ } else if (pm_cur->gpt) {
for (i = 0; i < MAX_WEDGES; i++)
if (wedges[i].pm == pm_cur &&
wedges[i].ptn == num)
snprintf(buf, len, "dk%d", i); // XXX: xxx
- } else
- snprintf(buf, len, "%s%c", pm_cur->diskdev, num + 'a');
+ } else {
+ r = snprintf(buf, len-1, "%s%c", pm_cur->diskdev, num + 'a');
+ if (r >= len)
+ buf[len] = 0;
+ }
return;
}
@@ -1918,7 +1923,8 @@
for (i = 0; i < MAX_VND; i++)
if (vnds[i].blocked && vnds[i].node == dev_num) {
pm_cur->refdev = &vnds[i];
- pm_getdevstring(dev, SSTRSIZE, vnds[i].pm, vnds[i].pm_part);
+ pm_getdevstring(dev, SSTRSIZE, vnds[i].pm,
+ vnds[i].pm_part);
r = snprintf(pm_cur->diskdev_descr,
sizeof(pm_cur->diskdev_descr)-1,
"%s (%s, %s)",
Home |
Main Index |
Thread Index |
Old Index