summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2010-01-22 08:51:58 +0000
committerjh <jh@FreeBSD.org>2010-01-22 08:51:58 +0000
commit904c85a87b091b9fdfcd22e0990f9383aa4ec7eb (patch)
treec62daf77b9389a37dd1e913d23aab68a5aa64b3a /sbin
parent03418e0c500f91bed6a159d72bf28c6b31fcdec4 (diff)
downloadFreeBSD-src-904c85a87b091b9fdfcd22e0990f9383aa4ec7eb.zip
FreeBSD-src-904c85a87b091b9fdfcd22e0990f9383aa4ec7eb.tar.gz
Make mdconfig(8) WARNS=6 clean:
- Constify geom_config_get() name argument. - Add void keyword for usage(). - Initialize mdunit to NULL. - Don't call md_prthumanval() at all if length is NULL. Approved by: trasz (mentor)
Diffstat (limited to 'sbin')
-rw-r--r--sbin/mdconfig/Makefile1
-rw-r--r--sbin/mdconfig/mdconfig.c13
2 files changed, 6 insertions, 8 deletions
diff --git a/sbin/mdconfig/Makefile b/sbin/mdconfig/Makefile
index 11223f2..f4d8adc 100644
--- a/sbin/mdconfig/Makefile
+++ b/sbin/mdconfig/Makefile
@@ -4,7 +4,6 @@ PROG= mdconfig
MAN= mdconfig.8
MLINKS= mdconfig.8 vnconfig.8
-WARNS?= 2
DPADD= ${LIBUTIL} ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
LDADD= -lutil -lgeom -lbsdxml -lsbuf
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index ec667c5..a564484 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -41,7 +41,7 @@ static void usage(void);
static int md_find(char *, const char *);
static int md_query(char *name);
static int md_list(char *units, int opt);
-static char *geom_config_get(struct gconf *g, char *name);
+static char *geom_config_get(struct gconf *g, const char *name);
static void md_prthumanval(char *length);
#define OPT_VERBOSE 0x01
@@ -52,7 +52,7 @@ static void md_prthumanval(char *length);
#define CLASS_NAME_MD "MD"
static void
-usage()
+usage(void)
{
fprintf(stderr,
"usage: mdconfig -a -t type [-n] [-o [no]option] ... [-f file]\n"
@@ -74,7 +74,7 @@ main(int argc, char **argv)
int ch, fd, i, vflag;
char *p;
int cmdline = 0;
- char *mdunit;
+ char *mdunit = NULL;
bzero(&mdio, sizeof(mdio));
mdio.md_file = malloc(PATH_MAX);
@@ -379,10 +379,9 @@ md_list(char *units, int opt)
if (strcmp(type, "vnode") == 0)
file = geom_config_get(gc, "file");
length = geom_config_get(gc, "length");
- if (length == NULL)
- length = "<a>";
printf("\t%s\t", type);
- md_prthumanval(length);
+ if (length != NULL)
+ md_prthumanval(length);
if (file != NULL) {
printf("\t%s", file);
file = NULL;
@@ -409,7 +408,7 @@ md_list(char *units, int opt)
* Returns value of 'name' from gconfig structure.
*/
static char *
-geom_config_get(struct gconf *g, char *name)
+geom_config_get(struct gconf *g, const char *name)
{
struct gconfig *gce;
OpenPOWER on IntegriCloud