atom feed10 messages in org.freebsd.freebsd-auditRe: date(1) WARNS=2 cleanup
FromSent OnAttachments
Sergey A. OsokinNov 23, 2001 4:09 am.Other
Sergey A. OsokinNov 23, 2001 5:11 am.Other
Dave ChapeskieNov 23, 2001 2:16 pm 
Sergey A. OsokinNov 26, 2001 7:54 am.Other
Andrew R. ReiterNov 26, 2001 9:07 am 
Peter PentchevNov 26, 2001 9:27 am 
Mike BarcroftNov 26, 2001 11:13 am 
Andrew R. ReiterNov 26, 2001 11:16 am 
Dave ChapeskieNov 26, 2001 5:29 pm 
Sergey A. OsokinNov 27, 2001 12:59 am.Other
Subject:Re: date(1) WARNS=2 cleanup
From:Dave Chapeskie (free@ddm.wox.org)
Date:Nov 23, 2001 2:16:43 pm
List:org.freebsd.freebsd-audit

On Fri, Nov 23, 2001 at 04:11:36PM +0300, Sergey A. Osokin wrote:

@@ -71,7 +71,7 @@ static void badformat __P((void)); static void usage __P((void));

-int logwtmp __P((char *, char *, char *)); +int logwtmp __P((const char *, const char *, const char *));

The manual page for logwtmp() clearly states that <libutil.h> needs to be included, the correct prototype is there. Remove the bogus prototype from date.c and include libutil.h instead.

int main(argc, argv) @@ -148,7 +148,7 @@ if (!rflag && time(&tval) == -1) err(1, "time");

- format = "%+"; + format = strdup("%+");

This change is incorrect. Strdup allocates memory which you never free. The correct solution to the warning created by this line is to change the type of 'format' from "char *" to "const char *".

diff -ruN date.orig/vary.c date/vary.c --- date.orig/vary.c Fri Nov 23 10:57:45 2001 +++ date/vary.c Fri Nov 23 13:08:31 2001 @@ -430,7 +430,7 @@ if (type == '\0') t->tm_isdst = -1;

- if (strspn(arg, digits) != len-1) { + if ((int)strspn(arg, digits) != len-1) { val = trans(trans_wday, arg); if (val != -1) { if (!adjwday(t, type, val, 1, 1))

A more appropriate fix is to change the type of 'len' from int to size_t, 'len' is initially assigned the return of strlen() which is also a size_t.

To Unsubscribe: send mail to majo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message