diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-11-12 01:14:42 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-11-12 01:14:42 +0000 |
commit | 1af61169269325a8703f15fe704b911bf9a2892b (patch) | |
tree | 9a1e0d1f082bd986f7b7a348aa8c6a5a5de77d0a /usr.bin/rdistd | |
parent | 439a2e177c7fc7552c89d2d52714439665db3dc6 (diff) |
Fix various format string issues. Stop assuming time_t is long or smaller.
Enable warnings.
ok krw@, ian@
Diffstat (limited to 'usr.bin/rdistd')
-rw-r--r-- | usr.bin/rdistd/Makefile | 3 | ||||
-rw-r--r-- | usr.bin/rdistd/server.c | 21 |
2 files changed, 13 insertions, 11 deletions
diff --git a/usr.bin/rdistd/Makefile b/usr.bin/rdistd/Makefile index 7dcca7df29d..bac7456575d 100644 --- a/usr.bin/rdistd/Makefile +++ b/usr.bin/rdistd/Makefile @@ -1,8 +1,9 @@ -# $OpenBSD: Makefile,v 1.4 2003/05/06 22:10:11 millert Exp $ +# $OpenBSD: Makefile,v 1.5 2012/11/12 01:14:41 guenther Exp $ PROG= rdistd SRCS= common.c filesys-os.c filesys.c message.c rdistd.c server.c .PATH: ${.CURDIR}/../rdist CFLAGS+=-I${.CURDIR}/../rdist -DOS_H=\"os-openbsd.h\" +WARNINGS=yes .include <bsd.prog.mk> diff --git a/usr.bin/rdistd/server.c b/usr.bin/rdistd/server.c index ab4343583d2..59b1a775ef4 100644 --- a/usr.bin/rdistd/server.c +++ b/usr.bin/rdistd/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.22 2011/04/10 15:47:28 krw Exp $ */ +/* $OpenBSD: server.c,v 1.23 2012/11/12 01:14:41 guenther Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -656,8 +656,9 @@ query(char *xname) case S_IFIFO: #endif #endif - (void) sendcmd(QC_YES, "%lld %ld %o %s %s", - (long long) stb.st_size, stb.st_mtime, + (void) sendcmd(QC_YES, "%lld %lld %o %s %s", + (long long) stb.st_size, + (long long) stb.st_mtime, stb.st_mode & 07777, getusername(stb.st_uid, target, options), getgroupname(stb.st_gid, target, options)); @@ -680,7 +681,7 @@ chkparent(char *name, opt_t opts) struct stat stb; int r = -1; - debugmsg(DM_CALL, "chkparent(%s, %o) start\n", name, opts); + debugmsg(DM_CALL, "chkparent(%s, %lo) start\n", name, opts); cp = strrchr(name, '/'); if (cp == NULL || cp == name) @@ -695,7 +696,7 @@ chkparent(char *name, opt_t opts) r = 0; } else debugmsg(DM_MISC, - "chkparent(%s, %o) mkdir fail: %s\n", + "chkparent(%s, %lo) mkdir fail: %s\n", name, opts, SYSERR); } } else /* It exists */ @@ -1428,7 +1429,7 @@ recvit(char *cmd, int type) /* * Get modification time */ - mtime = (time_t) strtol(cp, &cp, 10); + mtime = (time_t) strtoll(cp, &cp, 10); if (*cp++ != ' ') { error("recvit: mtime not delimited"); return; @@ -1437,7 +1438,7 @@ recvit(char *cmd, int type) /* * Get access time */ - atime = strtol(cp, &cp, 10); + atime = (time_t) strtoll(cp, &cp, 10); if (*cp++ != ' ') { error("recvit: atime not delimited"); return; @@ -1477,8 +1478,8 @@ recvit(char *cmd, int type) file = fileb; debugmsg(DM_MISC, - "recvit: opts = %04o mode = %04o size = %lld mtime = %d", - opts, mode, (long long) size, mtime); + "recvit: opts = %04lo mode = %04o size = %lld mtime = %lld", + opts, mode, (long long) size, (long long)mtime); debugmsg(DM_MISC, "recvit: owner = '%s' group = '%s' file = '%s' catname = %d isdir = %d", owner, group, file, catname, (type == S_IFDIR) ? 1 : 0); @@ -1633,7 +1634,7 @@ dochmog(char *cmd) file = fileb; debugmsg(DM_MISC, - "dochmog: opts = %04o mode = %04o", opts, mode); + "dochmog: opts = %04lo mode = %04o", opts, mode); debugmsg(DM_MISC, "dochmog: owner = '%s' group = '%s' file = '%s' catname = %d", owner, group, file, catname); |