Date: Tue, 27 Nov 2001 11:59:58 +0300 From: "Sergey A. Osokin" <osa@freebsd.org.ru> To: audit@FreeBSD.org Subject: Re: date(1) WARNS=2 cleanup Message-ID: <20011127115958.A33964@freebsd.org.ru> In-Reply-To: <20011126203002.A993@ddm.wox.org>; from freebsd@ddm.wox.org on Mon, Nov 26, 2001 at 08:30:02PM -0500 References: <20011123150934.A10406@freebsd.org.ru> <20011123161136.A11027@freebsd.org.ru> <20011123171705.A2462@ddm.wox.org> <20011126185449.A29823@freebsd.org.ru> <20011126203002.A993@ddm.wox.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Nov 26, 2001 at 08:30:02PM -0500, Dave Chapeskie wrote: > On Mon, Nov 26, 2001 at 06:54:50PM +0300, Sergey A. Osokin wrote: > > int ch, rflag; > int jflag, nflag; > - char *format, buf[1024]; > + const char *format; > + char buf[1024]; > char *endptr, *fmt; > char *tmp; > int set_timezone; OK. Please review patch one more time. -- Rgdz, /"\ Sergey Osokin aka oZZ, \ / ASCII RIBBON CAMPAIGN osa@freebsd.org.ru X AGAINST HTML MAIL http://freebsd.org.ru/~osa/ / \ --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-date diff -ruN date.orig/Makefile date/Makefile --- date.orig/Makefile Mon Nov 26 00:54:55 2001 +++ date/Makefile Mon Nov 26 05:45:11 2001 @@ -6,4 +6,6 @@ DPADD= ${LIBUTIL} LDADD= -lutil +WARNS?= 2 + .include <bsd.prog.mk> diff -ruN date.orig/date.c date/date.c --- date.orig/date.c Mon Nov 26 00:54:55 2001 +++ date/date.c Tue Nov 27 09:39:53 2001 @@ -50,12 +50,13 @@ #include <ctype.h> #include <err.h> +#include <libutil.h> +#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <syslog.h> #include <unistd.h> -#include <locale.h> #include "extern.h" #include "vary.h" @@ -71,8 +72,6 @@ static void badformat __P((void)); static void usage __P((void)); -int logwtmp __P((char *, char *, char *)); - int main(argc, argv) int argc; @@ -81,7 +80,8 @@ struct timezone tz; int ch, rflag; int jflag, nflag; - char *format, buf[1024]; + const char *format; + char buf[1024]; char *endptr, *fmt; char *tmp; int set_timezone; diff -ruN date.orig/netdate.c date/netdate.c --- date.orig/netdate.c Mon Nov 26 00:54:55 2001 +++ date/netdate.c Fri Nov 23 13:08:41 2001 @@ -74,10 +74,10 @@ struct timeval tout; struct servent *sp; struct tsp msg; - struct sockaddr_in sin, dest, from; + struct sockaddr_in osin, dest, from; fd_set ready; long waittime; - int s, length, port, timed_ack, found, err; + int s, length, port, timed_ack, found, oerr; char hostname[MAXHOSTNAMELEN]; if ((sp = getservbyname("timed", "udp")) == NULL) { @@ -95,11 +95,11 @@ return (retval = 2); } - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; + memset(&osin, 0, sizeof(osin)); + osin.sin_family = AF_INET; for (port = IPPORT_RESERVED - 1; port > IPPORT_RESERVED / 2; port--) { - sin.sin_port = htons((u_short)port); - if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0) + osin.sin_port = htons((u_short)port); + if (bind(s, (struct sockaddr *)&osin, sizeof(osin)) >= 0) break; if (errno == EADDRINUSE) continue; @@ -143,11 +143,11 @@ FD_SET(s, &ready); found = select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0, &tout); - length = sizeof(err); + length = sizeof(oerr); if (!getsockopt(s, - SOL_SOCKET, SO_ERROR, (char *)&err, &length) && err) { - if (err != ECONNREFUSED) - warnc(err, "send (delayed error)"); + SOL_SOCKET, SO_ERROR, (char *)&oerr, &length) && oerr) { + if (oerr != ECONNREFUSED) + warnc(oerr, "send (delayed error)"); goto bad; } diff -ruN date.orig/vary.c date/vary.c --- date.orig/vary.c Mon Nov 26 00:54:55 2001 +++ date/vary.c Sun Nov 25 23:59:42 2001 @@ -37,7 +37,7 @@ struct trans { int val; - char *str; + const char *str; }; static struct trans trans_mon[] = { @@ -203,14 +203,14 @@ static int adjday(struct tm *t, char type, int val, int mk) { - int mdays; + int omdays; switch (type) { case '+': while (val) { - mdays = daysinmonth(t); - if (val > mdays - t->tm_mday) { - val -= mdays - t->tm_mday + 1; + omdays = daysinmonth(t); + if (val > omdays - t->tm_mday) { + val -= omdays - t->tm_mday + 1; t->tm_mday = 1; if (!adjmon(t, '+', 1, 0, 0)) return 0; @@ -413,7 +413,7 @@ char type; char which; char *arg; - int len; + size_t len; int val; for (; v; v = v->next) { --UlVJffcvxoiEqYs2-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011127115958.A33964>