From 1161d4202c3c938b634bd14435ec9ba96755a5d2 Mon Sep 17 00:00:00 2001 From: Rebecca Cran Date: Mon, 22 Nov 2010 20:10:48 +0000 Subject: [PATCH] Fix some more warnings found by clang. --- bin/sh/arith_lex.l | 1 + sbin/bsdlabel/bsdlabel.c | 2 +- sbin/geom/class/eli/geom_eli.c | 2 +- sbin/geom/class/part/geom_part.c | 2 +- sbin/geom/class/virstor/geom_virstor.c | 12 ++++++------ sbin/growfs/debug.c | 2 +- sbin/gvinum/gvinum.c | 2 +- sbin/hastctl/Makefile | 1 + sbin/mknod/mknod.c | 2 +- usr.bin/ar/acplex.l | 1 + usr.bin/bc/scan.l | 1 + 11 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bin/sh/arith_lex.l b/bin/sh/arith_lex.l index aede40fd93d2..1113d2992970 100644 --- a/bin/sh/arith_lex.l +++ b/bin/sh/arith_lex.l @@ -55,6 +55,7 @@ int yylex(void); #define YY_INPUT(buf,result,max) \ result = (*buf = *arith_buf++) ? 1 : YY_NULL; #define YY_NO_UNPUT +#define YY_NO_INPUT %} %% diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index b671821f5ab9..974150d81fc5 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.c @@ -515,7 +515,7 @@ readlabel(int flag) f = open(specname, O_RDONLY); if (f < 0) - err(1, specname); + err(1, "%s", specname); if (is_file) get_file_parms(f); else { diff --git a/sbin/geom/class/eli/geom_eli.c b/sbin/geom/class/eli/geom_eli.c index e29c788166cb..25409e7d3c08 100644 --- a/sbin/geom/class/eli/geom_eli.c +++ b/sbin/geom/class/eli/geom_eli.c @@ -374,7 +374,7 @@ eli_genkey_files(struct gctl_req *req, bool new, const char *type, if (!gctl_has_param(req, argname)) return (i); - file = gctl_get_ascii(req, argname); + file = gctl_get_ascii(req, "%s", argname); assert(file != NULL); if (strcmp(file, "-") == 0) diff --git a/sbin/geom/class/part/geom_part.c b/sbin/geom/class/part/geom_part.c index 01b7fa437a89..482b02950392 100644 --- a/sbin/geom/class/part/geom_part.c +++ b/sbin/geom/class/part/geom_part.c @@ -614,7 +614,7 @@ static int gpart_show_hasopt(struct gctl_req *req, const char *opt, const char *elt) { - if (!gctl_get_int(req, opt)) + if (!gctl_get_int(req, "%s", opt)) return (0); if (elt != NULL) diff --git a/sbin/geom/class/virstor/geom_virstor.c b/sbin/geom/class/virstor/geom_virstor.c index be9a467b9fe6..15a56761da18 100644 --- a/sbin/geom/class/virstor/geom_virstor.c +++ b/sbin/geom/class/virstor/geom_virstor.c @@ -276,7 +276,7 @@ virstor_label(struct gctl_req *req) msize = secsize = 0; for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); ssize = g_get_sectorsize(name); if (ssize == 0) fprintf(stderr, "%s for %s\n", strerror(errno), name); @@ -336,7 +336,7 @@ virstor_label(struct gctl_req *req) for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); if (verbose) printf(" %s", name); @@ -417,7 +417,7 @@ virstor_label(struct gctl_req *req) /* Ok, store metadata. */ for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); msize = g_get_mediasize(name); ssize = g_get_sectorsize(name); @@ -434,7 +434,7 @@ virstor_label(struct gctl_req *req) if (verbose) printf("(%u chunks) ", md.chunk_count); /* Check to make sure last sector is unused */ - if ((off_t)(md.chunk_count * md.md_chunk_size) > msize-ssize) + if ((off_t)(md.chunk_count * md.md_chunk_size) > (off_t)(msize-ssize)) md.chunk_count--; md.chunk_next = 0; if (i != 1) { @@ -499,7 +499,7 @@ virstor_clear(struct gctl_req *req) } for (i = 0; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); error = g_metadata_clear(name, G_VIRSTOR_MAGIC); if (error != 0) { @@ -564,7 +564,7 @@ virstor_dump(struct gctl_req *req) } for (i = 0; i < nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); error = g_metadata_read(name, (u_char *) & tmpmd, sizeof(tmpmd), G_VIRSTOR_MAGIC); diff --git a/sbin/growfs/debug.c b/sbin/growfs/debug.c index 15effec81587..5072fc176ca8 100644 --- a/sbin/growfs/debug.c +++ b/sbin/growfs/debug.c @@ -281,7 +281,7 @@ dbg_dump_fs(struct fs *sb, const char *comment) */ fprintf(dbg_log, "maxbsize int32_t 0x%08x\n", sb->fs_maxbsize); - fprintf(dbg_log, "unrefs int64_t 0x%08x\n", + fprintf(dbg_log, "unrefs int64_t 0x%08jx\n", sb->fs_unrefs); fprintf(dbg_log, "sblockloc int64_t 0x%08x%08x\n", ((unsigned int *)&(sb->fs_sblockloc))[1], diff --git a/sbin/gvinum/gvinum.c b/sbin/gvinum/gvinum.c index 3b350f8151ac..f936a58cda7c 100644 --- a/sbin/gvinum/gvinum.c +++ b/sbin/gvinum/gvinum.c @@ -1427,5 +1427,5 @@ printconfig(FILE *of, char *comment) if (*comment != '\0') fprintf(of, "# Current configuration:\n"); - fprintf(of, buf); + fprintf(of, "%s", buf); } diff --git a/sbin/hastctl/Makefile b/sbin/hastctl/Makefile index 301493cec79b..0592e160a584 100644 --- a/sbin/hastctl/Makefile +++ b/sbin/hastctl/Makefile @@ -24,6 +24,7 @@ CFLAGS+=-DINET6 .endif # This is needed to have WARNS > 1. CFLAGS+=-DYY_NO_UNPUT +CFLAGS+=-DYY_NO_INPUT DPADD= ${LIBL} LDADD= -ll diff --git a/sbin/mknod/mknod.c b/sbin/mknod/mknod.c index 6905cae0a66f..76bb2e549c7b 100644 --- a/sbin/mknod/mknod.c +++ b/sbin/mknod/mknod.c @@ -139,7 +139,7 @@ main(int argc, char **argv) errx(1, "%s: non-numeric minor number", argv[4]); range_error |= errno; dev = makedev(mymajor, myminor); - if (range_error || major(dev) != (u_int) mymajor || + if (range_error || major(dev) != mymajor || (long)(u_int)minor(dev) != myminor) errx(1, "major or minor number too large"); } else { diff --git a/usr.bin/ar/acplex.l b/usr.bin/ar/acplex.l index 3186d170ced2..0acf5b79d13b 100644 --- a/usr.bin/ar/acplex.l +++ b/usr.bin/ar/acplex.l @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include "y.tab.h" #define YY_NO_UNPUT +#define YY_NO_INPUT int lineno = 1; int yylex(void); diff --git a/usr.bin/bc/scan.l b/usr.bin/bc/scan.l index 1f818936090d..5d60bb37c232 100644 --- a/usr.bin/bc/scan.l +++ b/usr.bin/bc/scan.l @@ -46,6 +46,7 @@ static void init_strbuf(void); static void add_str(const char *); static int bc_yyinput(char *, int); +#define YY_NO_INPUT #undef YY_INPUT #define YY_INPUT(buf,retval,max) \ (retval = bc_yyinput(buf, max))