From 8064490359939e712f4246b0e88db8a1cd645554 Mon Sep 17 00:00:00 2001 From: lukem Date: Fri, 19 Oct 2001 01:16:37 +0000 Subject: [PATCH] minor WARNS=2 stuff --- sbin/disklabel/disklabel.c | 31 +++++++++++++++++-------------- sbin/disklabel/interact.c | 6 +++--- sbin/disklabel/printlabel.c | 8 ++++---- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 1e5d847780de..f4299b48b7e6 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: disklabel.c,v 1.98 2001/06/15 18:49:37 nonaka Exp $ */ +/* $NetBSD: disklabel.c,v 1.99 2001/10/19 01:16:37 lukem Exp $ */ /* * Copyright (c) 1987, 1993 @@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\ static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95"; /* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */ #else -__RCSID("$NetBSD: disklabel.c,v 1.98 2001/06/15 18:49:37 nonaka Exp $"); +__RCSID("$NetBSD: disklabel.c,v 1.99 2001/10/19 01:16:37 lukem Exp $"); #endif #endif /* not lint */ @@ -847,7 +847,7 @@ readlabel(int f) struct disklabel *lp; if (rflag || Iflag) { - char *msg; + const char *msg; off_t sectoffset; msg = NULL; @@ -1212,7 +1212,7 @@ static int editit(void) { int pid, xpid; - int stat; + int status; sigset_t sigset, osigset; sigemptyset(&sigset); @@ -1247,11 +1247,11 @@ editit(void) perror(ed); exit(retval); } - while ((xpid = wait(&stat)) >= 0) + while ((xpid = wait(&status)) >= 0) if (xpid == pid) break; sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0); - return (!stat); + return (!status); } static char * @@ -1291,8 +1291,7 @@ getasciilabel(FILE *f, struct disklabel *lp) { const char *const *cpp, *s; struct partition *pp; - char *cp; - char *tp, line[BUFSIZ]; + char *cp, *tp, line[BUFSIZ], tbuf[15]; int v, lineno, errors; lineno = 0; @@ -1314,8 +1313,10 @@ getasciilabel(FILE *f, struct disklabel *lp) } *tp++ = '\0', tp = skip(tp); if (!strcmp(cp, "type")) { - if (tp == NULL) - tp = "unknown"; + if (tp == NULL) { + strlcpy(tbuf, "unknown", sizeof(tbuf)); + tp = tbuf; + } cpp = dktypenames; for (; cpp < &dktypenames[DKMAXTYPES]; cpp++) if ((s = *cpp) && !strcasecmp(s, tp)) { @@ -1365,8 +1366,10 @@ getasciilabel(FILE *f, struct disklabel *lp) lp->d_npartitions = v; continue; } - if (tp == NULL) - tp = ""; + if (tp == NULL) { + tbuf[0] = '\0'; + tp = tbuf; + } if (!strcmp(cp, "disk")) { strncpy(lp->d_typename, tp, sizeof(lp->d_typename)); continue; @@ -1774,8 +1777,8 @@ static void usage(void) { static const struct { - char *name; - char *expn; + const char *name; + const char *expn; } usages[] = { { "[-rt] [-C] disk", "(to read label)" }, diff --git a/sbin/disklabel/interact.c b/sbin/disklabel/interact.c index 4c58599f68c5..2ebf14c1e4d2 100644 --- a/sbin/disklabel/interact.c +++ b/sbin/disklabel/interact.c @@ -1,4 +1,4 @@ -/* $NetBSD: interact.c,v 1.18 2001/05/26 19:48:32 christos Exp $ */ +/* $NetBSD: interact.c,v 1.19 2001/10/19 01:16:38 lukem Exp $ */ /* * Copyright (c) 1997 Christos Zoulas. All rights reserved. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: interact.c,v 1.18 2001/05/26 19:48:32 christos Exp $"); +__RCSID("$NetBSD: interact.c,v 1.19 2001/10/19 01:16:38 lukem Exp $"); #endif /* lint */ #include @@ -622,7 +622,7 @@ dumpnames(const char *prompt, const char * const *olist, size_t numentries) printf("%s%s", i == 0 ? "" : ", ", list[i]); puts(""); #endif - (void)qsort((void *)list, numentries, sizeof(char *), alphacmp); + (void)qsort(list, numentries, sizeof(char *), alphacmp); width++; /* want two spaces between items */ width = (width + 8) &~ 7; diff --git a/sbin/disklabel/printlabel.c b/sbin/disklabel/printlabel.c index 9af0b1de2ee0..1d9dad3cf4d8 100644 --- a/sbin/disklabel/printlabel.c +++ b/sbin/disklabel/printlabel.c @@ -1,4 +1,4 @@ -/* $NetBSD: printlabel.c,v 1.2 2001/05/26 19:48:32 christos Exp $ */ +/* $NetBSD: printlabel.c,v 1.3 2001/10/19 01:16:38 lukem Exp $ */ /* * Copyright (c) 1987, 1993 @@ -38,7 +38,7 @@ #include #ifndef lint -__RCSID("$NetBSD: printlabel.c,v 1.2 2001/05/26 19:48:32 christos Exp $"); +__RCSID("$NetBSD: printlabel.c,v 1.3 2001/10/19 01:16:38 lukem Exp $"); #endif /* not lint */ #include @@ -53,11 +53,11 @@ __RCSID("$NetBSD: printlabel.c,v 1.2 2001/05/26 19:48:32 christos Exp $"); void -showinfo(FILE *f, struct disklabel *lp, const char *specname) +showinfo(FILE *f, struct disklabel *lp, const char *specialname) { int i, j; - (void)fprintf(f, "# %s:\n", specname); + (void)fprintf(f, "# %s:\n", specialname); if ((unsigned) lp->d_type < DKMAXTYPES) (void)fprintf(f, "type: %s\n", dktypenames[lp->d_type]); else