| From | Sent On | Attachments |
|---|---|---|
| Sergey A. Osokin | Nov 23, 2001 4:09 am | .Other |
| Sergey A. Osokin | Nov 23, 2001 5:11 am | .Other |
| Dave Chapeskie | Nov 23, 2001 2:16 pm | |
| Sergey A. Osokin | Nov 26, 2001 7:54 am | .Other |
| Andrew R. Reiter | Nov 26, 2001 9:07 am | |
| Peter Pentchev | Nov 26, 2001 9:27 am | |
| Mike Barcroft | Nov 26, 2001 11:13 am | |
| Andrew R. Reiter | Nov 26, 2001 11:16 am | |
| Dave Chapeskie | Nov 26, 2001 5:29 pm | |
| Sergey A. Osokin | Nov 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.
-- Dave Chapeskie OpenPGP Key ID: 0x3D2B6B34
To Unsubscribe: send mail to majo...@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message






.Other