diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-08-22 04:43:42 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-08-22 04:43:42 +0000 |
commit | 323d1abbc45a9dfeae3d39b5f8cc041dc4b73bd1 (patch) | |
tree | 64ea330e44da28fb9da88722be4cb4e200afe707 /usr.sbin | |
parent | 31003a7e68970e14de72e158246cccd33cccc1e7 (diff) |
Correct format string mismatches turned up by -Wformat=2
suggestions and ok millert@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/apmd/apmd.c | 6 | ||||
-rw-r--r-- | usr.sbin/httpd/src/main/http_protocol.c | 10 | ||||
-rw-r--r-- | usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c | 4 | ||||
-rw-r--r-- | usr.sbin/kvm_mkdb/nlist.c | 4 | ||||
-rw-r--r-- | usr.sbin/mtree/create.c | 4 | ||||
-rw-r--r-- | usr.sbin/pstat/pstat.c | 4 | ||||
-rw-r--r-- | usr.sbin/quot/quot.c | 12 | ||||
-rw-r--r-- | usr.sbin/rbootd/utils.c | 8 | ||||
-rw-r--r-- | usr.sbin/route6d/route6d.c | 4 | ||||
-rw-r--r-- | usr.sbin/ypserv/makedbm/makedbm.c | 8 | ||||
-rw-r--r-- | usr.sbin/ypserv/mkalias/mkalias.c | 5 |
11 files changed, 38 insertions, 31 deletions
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c index c09370d9d54..e225c17e896 100644 --- a/usr.sbin/apmd/apmd.c +++ b/usr.sbin/apmd/apmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apmd.c,v 1.61 2013/05/19 18:37:40 tedu Exp $ */ +/* $OpenBSD: apmd.c,v 1.62 2013/08/22 04:43:41 guenther Exp $ */ /* * Copyright (c) 1995, 1996 John T. Kohl @@ -666,8 +666,8 @@ main(int argc, char *argv[]) if (ev->ident == ctl_fd) { suspends = standbys = resumes = 0; syslog(LOG_DEBUG, "apmevent %04x index %d", - APM_EVENT_TYPE(ev->data), - APM_EVENT_INDEX(ev->data)); + (int)APM_EVENT_TYPE(ev->data), + (int)APM_EVENT_INDEX(ev->data)); switch (APM_EVENT_TYPE(ev->data)) { case APM_SUSPEND_REQ: diff --git a/usr.sbin/httpd/src/main/http_protocol.c b/usr.sbin/httpd/src/main/http_protocol.c index e26c60ab883..f2a91318257 100644 --- a/usr.sbin/httpd/src/main/http_protocol.c +++ b/usr.sbin/httpd/src/main/http_protocol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_protocol.c,v 1.38 2013/08/08 03:16:13 guenther Exp $ */ +/* $OpenBSD: http_protocol.c,v 1.39 2013/08/22 04:43:41 guenther Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -1349,14 +1349,14 @@ API_EXPORT(void) ap_note_digest_auth_failure(request_rec *r) */ char * nonce_prefix = ap_md5(r->pool, (unsigned char *) - ap_psprintf(r->pool, "%s%lu", - ap_auth_nonce(r), r->request_time)); + ap_psprintf(r->pool, "%s%lld", + ap_auth_nonce(r), (long long)r->request_time)); ap_table_setn(r->err_headers_out, r->proxyreq == STD_PROXY ? "Proxy-Authenticate" : "WWW-Authenticate", - ap_psprintf(r->pool, "Digest realm=\"%s\", nonce=\"%s%lu\"", - ap_auth_name(r), nonce_prefix, r->request_time)); + ap_psprintf(r->pool, "Digest realm=\"%s\", nonce=\"%s%lld\"", + ap_auth_name(r), nonce_prefix, (long long)r->request_time)); } API_EXPORT(int) ap_get_basic_auth_pw(request_rec *r, const char **pw) diff --git a/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c b/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c index 0115ec15208..3aaef8eb29d 100644 --- a/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c +++ b/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_auth_digest.c,v 1.22 2008/05/25 11:46:27 mbalmer Exp $ */ +/* $OpenBSD: mod_auth_digest.c,v 1.23 2013/08/22 04:43:41 guenther Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -884,7 +884,7 @@ static int check_nonce(request_rec *r, digest_header_rec *resp, if (strlen(resp->nonce) != NONCE_LEN) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, - "Digest: invalid nonce %s received - length is not %d", + "Digest: invalid nonce %s received - length is not %zu", resp->nonce, NONCE_LEN); note_digest_auth_failure(r, conf, resp, 1); return AUTH_REQUIRED; diff --git a/usr.sbin/kvm_mkdb/nlist.c b/usr.sbin/kvm_mkdb/nlist.c index 267a2bda9b0..8edd6f687b7 100644 --- a/usr.sbin/kvm_mkdb/nlist.c +++ b/usr.sbin/kvm_mkdb/nlist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nlist.c,v 1.41 2013/01/29 22:39:06 miod Exp $ */ +/* $OpenBSD: nlist.c,v 1.42 2013/08/22 04:43:41 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -318,7 +318,7 @@ __elf_knlist(int fd, DB *db, int ksyms) sh = (Elf_Shdr *)calloc(sizeof(Elf_Shdr), eh.e_shnum); if (sh == NULL) - errx(1, "cannot allocate %d bytes for symbol header", + errx(1, "cannot allocate %zu bytes for symbol header", sizeof(Elf_Shdr) * eh.e_shnum); if (fseek (fp, eh.e_shoff, SEEK_SET) < 0) { diff --git a/usr.sbin/mtree/create.c b/usr.sbin/mtree/create.c index 3eb80cb98c1..777a9bff344 100644 --- a/usr.sbin/mtree/create.c +++ b/usr.sbin/mtree/create.c @@ -1,5 +1,5 @@ /* $NetBSD: create.c,v 1.11 1996/09/05 09:24:19 mycroft Exp $ */ -/* $OpenBSD: create.c,v 1.28 2013/04/16 23:42:44 deraadt Exp $ */ +/* $OpenBSD: create.c,v 1.29 2013/08/22 04:43:41 guenther Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -195,7 +195,7 @@ statf(int indent, FTSENT *p) crc(fd, &val, &len)) error("%s: %s", p->fts_accpath, strerror(errno)); (void)close(fd); - output(indent, &offset, "cksum=%lu", val); + output(indent, &offset, "cksum=%u", val); } if (keys & F_MD5 && S_ISREG(p->fts_statp->st_mode)) { char *md5digest, buf[MD5_DIGEST_STRING_LENGTH]; diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index 8ae34e9e90b..ccfb8652d51 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pstat.c,v 1.85 2013/06/05 01:26:00 guenther Exp $ */ +/* $OpenBSD: pstat.c,v 1.86 2013/08/22 04:43:41 guenther Exp $ */ /* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */ /*- @@ -607,7 +607,7 @@ nfs_print(struct vnode *vp) *flags++ = '-'; *flags = '\0'; - (void)printf(" %6ld %5s", np->n_vattr.va_fileid, flagbuf); + (void)printf(" %6lld %5s", (long long)np->n_vattr.va_fileid, flagbuf); type = np->n_vattr.va_mode & S_IFMT; if (S_ISCHR(np->n_vattr.va_mode) || S_ISBLK(np->n_vattr.va_mode)) if (usenumflag || diff --git a/usr.sbin/quot/quot.c b/usr.sbin/quot/quot.c index 04c6d3a291d..3c096964b8f 100644 --- a/usr.sbin/quot/quot.c +++ b/usr.sbin/quot/quot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: quot.c,v 1.22 2013/06/11 16:42:19 deraadt Exp $ */ +/* $OpenBSD: quot.c,v 1.23 2013/08/22 04:43:41 guenther Exp $ */ /* * Copyright (C) 1991, 1994 Wolfgang Solfrank. @@ -406,8 +406,9 @@ dofsizes(int fd, struct fs *super, char *name) for (fp = fsizes; fp; fp = fp->fsz_next) { for (i = 0; i < FSZCNT; i++) { if (fp->fsz_count[i]) - printf("%d\t%d\t%lld\n", - fp->fsz_first + i, fp->fsz_count[i], + printf("%lld\t%llu\t%lld\n", + (long long)fp->fsz_first + i, + (unsigned long long)fp->fsz_count[i], SIZE(sz += fp->fsz_sz[i])); } } @@ -456,7 +457,8 @@ static void donames(int fd, struct fs *super, char *name) { int c; - ino_t inode, inode1; + unsigned long long inode; + ino_t inode1; ino_t maxino; union dinode *dp; @@ -466,7 +468,7 @@ donames(int fd, struct fs *super, char *name) while ((c = getchar()) != EOF && c != '\n'); ungetc(c, stdin); inode1 = -1; - while (scanf("%d", &inode) == 1) { + while (scanf("%llu", &inode) == 1) { if (inode < 0 || inode > maxino) { #ifndef COMPAT fprintf(stderr, "invalid inode %llu\n", diff --git a/usr.sbin/rbootd/utils.c b/usr.sbin/rbootd/utils.c index 16a6aceb5db..3ad5792d51a 100644 --- a/usr.sbin/rbootd/utils.c +++ b/usr.sbin/rbootd/utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utils.c,v 1.11 2013/04/03 03:20:39 deraadt Exp $ */ +/* $OpenBSD: utils.c,v 1.12 2013/08/22 04:43:41 guenther Exp $ */ /* $NetBSD: utils.c,v 1.5.2.1 1995/11/14 08:45:46 thorpej Exp $ */ /* @@ -71,8 +71,10 @@ void DispPkt(RMPCONN *rconn, int direct) { - static char BootFmt[] = "\t\tRetCode:%u SeqNo:%lx SessID:%x Vers:%u"; - static char ReadFmt[] = "\t\tRetCode:%u Offset:%lx SessID:%x\n"; + static const char BootFmt[] = + "\t\tRetCode:%u SeqNo:%x SessID:%x Vers:%u"; + static const char ReadFmt[] = + "\t\tRetCode:%u Offset:%x SessID:%x\n"; struct tm *tmp; struct rmp_packet *rmp; int i, omask; diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c index 450e7140db4..5386cc3f4bc 100644 --- a/usr.sbin/route6d/route6d.c +++ b/usr.sbin/route6d/route6d.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route6d.c,v 1.56 2013/03/21 04:43:17 deraadt Exp $ */ +/* $OpenBSD: route6d.c,v 1.57 2013/08/22 04:43:41 guenther Exp $ */ /* $KAME: route6d.c,v 1.111 2006/10/25 06:38:13 jinmei Exp $ */ /* @@ -1138,7 +1138,7 @@ riprecv(void) if (iff_find(ifcp, 'N') != NULL) return; - tracet(1, "Recv(%s): from %s.%d info(%d)\n", + tracet(1, "Recv(%s): from %s.%d info(%zd)\n", ifcp->ifc_name, inet6_n2p(&nh), ntohs(fsock.sin6_port), nn); t = time(NULL); diff --git a/usr.sbin/ypserv/makedbm/makedbm.c b/usr.sbin/ypserv/makedbm/makedbm.c index f819b752efa..9a1a7881dcc 100644 --- a/usr.sbin/ypserv/makedbm/makedbm.c +++ b/usr.sbin/ypserv/makedbm/makedbm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makedbm.c,v 1.29 2009/10/27 23:59:57 deraadt Exp $ */ +/* $OpenBSD: makedbm.c,v 1.30 2013/08/22 04:43:41 guenther Exp $ */ /* * Copyright (c) 1994-97 Mats O Jansson <moj@stacken.kth.se> @@ -111,14 +111,16 @@ file_date(char *filename) int status; if (strcmp(filename,"-") == 0) { - snprintf(datestr, sizeof datestr, "%010u", time(0)); + snprintf(datestr, sizeof datestr, "%010lld", + (long long)time(0)); } else { status = stat(filename, &finfo); if (status < 0) { fprintf(stderr, "%s: can't stat %s\n", __progname, filename); exit(1); } - snprintf(datestr, sizeof datestr, "%010u", finfo.st_mtime); + snprintf(datestr, sizeof datestr, "%010lld", + (long long)finfo.st_mtime); } return datestr; } diff --git a/usr.sbin/ypserv/mkalias/mkalias.c b/usr.sbin/ypserv/mkalias/mkalias.c index 58e8806bf14..6f4594318c1 100644 --- a/usr.sbin/ypserv/mkalias/mkalias.c +++ b/usr.sbin/ypserv/mkalias/mkalias.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkalias.c,v 1.24 2010/06/29 03:47:40 deraadt Exp $ */ +/* $OpenBSD: mkalias.c,v 1.25 2013/08/22 04:43:41 guenther Exp $ */ /* * Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se> @@ -288,7 +288,8 @@ fail: } if (new_db != NULL) { - snprintf(datestr, sizeof datestr, "%010u", time(NULL)); + snprintf(datestr, sizeof datestr, "%010lld", + (long long)time(NULL)); key.dptr = YP_LAST_KEY; key.dsize = strlen(YP_LAST_KEY); val.dptr = datestr; |