From owner-freebsd-audit Wed Nov 21 19:32:54 2001 Delivered-To: freebsd-audit@freebsd.org Received: from Veronica.wmol.com (veronica.wmol.com [208.242.83.241]) by hub.freebsd.org (Postfix) with ESMTP id 4F7EC37B416; Wed, 21 Nov 2001 19:32:49 -0800 (PST) Received: from rain.hill.hom (24.247.81.122.bay.mi.chartermi.net [24.247.81.122]) by Veronica.wmol.com (Vircom SMTPRS 5.0.193) with ESMTP id ; Wed, 21 Nov 2001 22:29:21 -0500 Date: Wed, 21 Nov 2001 22:32:02 +0000 From: David Hill To: freebsd-audit@freebsd.org, freebsd-current@freebsd.org Subject: libfetch kqueue patch Message-Id: <20011121223202.0e85d777.david@phobia.ms> X-Mailer: Sylpheed version 0.6.4 (GTK+ 1.2.10; i386--freebsd5.0) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Wed__21_Nov_2001_22:32:02_+0000_081c5200" Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --Multipart_Wed__21_Nov_2001_22:32:02_+0000_081c5200 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello - This patch converts libfetch to use kqueue instead of select. Thanks David Hill --Multipart_Wed__21_Nov_2001_22:32:02_+0000_081c5200 Content-Type: application/octet-stream; name="fetch-common.c.patch" Content-Disposition: attachment; filename="fetch-common.c.patch" Content-Transfer-Encoding: base64 LS0tIC91c3Ivc3JjL2xpYi9saWJmZXRjaC9jb21tb24uYy5vcmlnCVdlZCBOb3YgMjEgMjI6MTE6 MjMgMjAwMQorKysgL3Vzci9zcmMvbGliL2xpYmZldGNoL2NvbW1vbi5jCVdlZCBOb3YgMjEgMjI6 MjE6NTAgMjAwMQpAQCAtMzIsNiArMzIsNyBAQAogI2luY2x1ZGUgPHN5cy9wYXJhbS5oPgogI2lu Y2x1ZGUgPHN5cy9zb2NrZXQuaD4KICNpbmNsdWRlIDxzeXMvdGltZS5oPgorI2luY2x1ZGUgPHN5 cy9ldmVudC5oPgogI2luY2x1ZGUgPHN5cy91aW8uaD4KICNpbmNsdWRlIDxuZXRpbmV0L2luLmg+ CiAKQEAgLTI1Niw4ICsyNTcsOSBAQAogX2ZldGNoX2dldGxuKGludCBmZCwgY2hhciAqKmJ1Ziwg c2l6ZV90ICpzaXplLCBzaXplX3QgKmxlbikKIHsKICAgICBzdHJ1Y3QgdGltZXZhbCBub3csIHRp bWVvdXQsIHdhaXQ7Ci0gICAgZmRfc2V0IHJlYWRmZHM7Ci0gICAgaW50IHI7CisgICAgc3RydWN0 IHRpbWVzcGVjIHdhaXRrcTsKKwlzdHJ1Y3Qga2V2ZW50IGtlOworICAgIGludCByLCBrcTsKICAg ICBjaGFyIGM7CiAgICAgCiAgICAgaWYgKCpidWYgPT0gTlVMTCkgewpAQCAtMjc0LDEyICsyNzYs MTcgQEAKICAgICBpZiAoZmV0Y2hUaW1lb3V0KSB7CiAJZ2V0dGltZW9mZGF5KCZ0aW1lb3V0LCBO VUxMKTsKIAl0aW1lb3V0LnR2X3NlYyArPSBmZXRjaFRpbWVvdXQ7Ci0JRkRfWkVSTygmcmVhZGZk cyk7CiAgICAgfQogICAgIAotICAgIGRvIHsKKwlpZiAoKGtxID0ga3F1ZXVlKCkpIDwgMCkKKwkJ cmV0dXJuIC0xOworCQkKKwlFVl9TRVQoJmtlLCBmZCwgRVZGSUxUX1JFQUQsIEVWX0FERCB8IEVW X0VOQUJMRSwgMCwgTlVMTCwgTlVMTCk7CisJaWYgKGtldmVudChrcSwgJmtlLCAxLCBOVUxMLCAw LCBOVUxMKSA8IDApCisJCXJldHVybiAtMTsKKyAgICAKKwlkbyB7CiAJaWYgKGZldGNoVGltZW91 dCkgewotCSAgICBGRF9TRVQoZmQsICZyZWFkZmRzKTsKIAkgICAgZ2V0dGltZW9mZGF5KCZub3cs IE5VTEwpOwogCSAgICB3YWl0LnR2X3NlYyA9IHRpbWVvdXQudHZfc2VjIC0gbm93LnR2X3NlYzsK IAkgICAgd2FpdC50dl91c2VjID0gdGltZW91dC50dl91c2VjIC0gbm93LnR2X3VzZWM7CkBAIC0y OTEsMTUgKzI5OCwxNSBAQAogCQllcnJubyA9IEVUSU1FRE9VVDsKIAkJcmV0dXJuIC0xOwogCSAg ICB9Ci0JICAgIHIgPSBzZWxlY3QoZmQrMSwgJnJlYWRmZHMsIE5VTEwsIE5VTEwsICZ3YWl0KTsK KwkJd2FpdGtxLnR2X3NlYyA9IHdhaXQudHZfc2VjOworCQl3YWl0a3EudHZfbnNlYyA9IHdhaXQu dHZfdXNlYyAqIDEwMDA7CisJCXIgPSBrZXZlbnQoa3EsIE5VTEwsIDAsICZrZSwgMSwgJndhaXRr cSk7CiAJICAgIGlmIChyID09IC0xKSB7CiAJCWlmIChlcnJubyA9PSBFSU5UUiAmJiBmZXRjaFJl c3RhcnRDYWxscykKIAkJICAgIGNvbnRpbnVlOwogCQkvKiBFQkFERiBvciBFSU5WQUw6IHNob3Vs ZG4ndCBoYXBwZW4gKi8KIAkJcmV0dXJuIC0xOwogCSAgICB9Ci0JICAgIGlmICghRkRfSVNTRVQo ZmQsICZyZWFkZmRzKSkKLQkJY29udGludWU7CiAJfQogCXIgPSByZWFkKGZkLCAmYywgMSk7CiAJ aWYgKHIgPT0gMCkKQEAgLTMyNSw2ICszMzIsOCBAQAogICAgIH0gd2hpbGUgKGMgIT0gJ1xuJyk7 CiAgICAgCiAgICAgREVCVUcoZnByaW50ZihzdGRlcnIsICJcMDMzWzFtPDw8ICUuKnNcMDMzW20i LCAoaW50KSpsZW4sICpidWYpKTsKKwkKKwljbG9zZShrcSk7CiAgICAgcmV0dXJuIDA7CiB9CiAK --Multipart_Wed__21_Nov_2001_22:32:02_+0000_081c5200-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Nov 22 2:37:34 2001 Delivered-To: freebsd-audit@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id E4CDA37B41A; Thu, 22 Nov 2001 02:37:30 -0800 (PST) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 1756714C2E; Thu, 22 Nov 2001 11:37:29 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: David Hill Cc: freebsd-audit@freebsd.org, freebsd-current@freebsd.org Subject: Re: libfetch kqueue patch References: <20011121223202.0e85d777.david@phobia.ms> From: Dag-Erling Smorgrav Date: 22 Nov 2001 11:37:28 +0100 In-Reply-To: <20011121223202.0e85d777.david@phobia.ms> Message-ID: Lines: 9 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG David Hill writes: > This patch converts libfetch to use kqueue instead of select. Why? It reduces neither the size nor the complexity of the code, and does not result in any notable performance improvements. DES -- Dag-Erling Smorgrav - des@ofug.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Nov 22 3: 3:15 2001 Delivered-To: freebsd-audit@freebsd.org Received: from alcatraz.iptelecom.net.ua (alcatraz.iptelecom.net.ua [212.9.224.15]) by hub.freebsd.org (Postfix) with ESMTP id B7B6537B419; Thu, 22 Nov 2001 03:02:58 -0800 (PST) Received: from ipcard.iptcom.net (ipcard.iptcom.net [212.9.224.5]) by alcatraz.iptelecom.net.ua (8.9.3/8.9.3) with ESMTP id NAA86368; Thu, 22 Nov 2001 13:00:27 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from vega.vega.com (h9.229.dialup.iptcom.net [212.9.229.9]) by ipcard.iptcom.net (8.9.3/8.9.3) with ESMTP id NAA38154; Thu, 22 Nov 2001 13:00:25 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Received: from FreeBSD.org (big_brother.vega.com [192.168.1.1]) by vega.vega.com (8.11.6/8.11.3) with ESMTP id fAMAxrY72639; Thu, 22 Nov 2001 12:59:53 +0200 (EET) (envelope-from sobomax@FreeBSD.org) Message-ID: <3BFCDB3F.F0DD7BA0@FreeBSD.org> Date: Thu, 22 Nov 2001 13:02:23 +0200 From: Maxim Sobolev Organization: Vega International Capital X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U) X-Accept-Language: en,uk,ru MIME-Version: 1.0 To: Dag-Erling Smorgrav Cc: David Hill , freebsd-audit@FreeBSD.org, freebsd-current@FreeBSD.org Subject: Re: libfetch kqueue patch References: <20011121223202.0e85d777.david@phobia.ms> Content-Type: text/plain; charset=x-user-defined Content-Transfer-Encoding: 7bit Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dag-Erling Smorgrav wrote: > > David Hill writes: > > This patch converts libfetch to use kqueue instead of select. > > Why? It reduces neither the size nor the complexity of the code, and > does not result in any notable performance improvements. For what it's worth, it also makes code less portable. -Maxim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Nov 23 4: 9:54 2001 Delivered-To: freebsd-audit@freebsd.org Received: from freebsd.org.ru (sweet.etrust.ru [194.84.67.5]) by hub.freebsd.org (Postfix) with ESMTP id 75B6B37B405 for ; Fri, 23 Nov 2001 04:09:43 -0800 (PST) Received: by freebsd.org.ru (Postfix, from userid 1000) id 031DA2CC; Fri, 23 Nov 2001 15:09:35 +0300 (MSK) Date: Fri, 23 Nov 2001 15:09:34 +0300 From: "Sergey A. Osokin" To: audit@FreeBSD.org Subject: date(1) WARNS=2 cleanup Message-ID: <20011123150934.A10406@freebsd.org.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="FL5UXtIhxfXey3p5" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello. Please review a patch for WARNS2'fy date(1). Before commit, tsptype's type (in src/include/protocols/timed.h) must be changed from (char *) to (const char *). Another way is commit patch without changes in src/bin/date/Makefile. Thanks. -- Rgdz, /"\ Sergey Osokin aka oZZ, \ / ASCII RIBBON CAMPAIGN osa@freebsd.org.ru X AGAINST HTML MAIL http://freebsd.org.ru/~osa/ / \ --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-date diff -ruN date.orig/Makefile date/Makefile --- date.orig/Makefile Fri Nov 23 10:57:45 2001 +++ date/Makefile Thu Nov 22 18:58:07 2001 @@ -6,4 +6,6 @@ DPADD= ${LIBUTIL} LDADD= -lutil +WARNS?= 2 + .include diff -ruN date.orig/date.c date/date.c --- date.orig/date.c Fri Nov 23 10:57:45 2001 +++ date/date.c Thu Nov 22 19:27:19 2001 @@ -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 *)); int main(argc, argv) @@ -148,7 +148,7 @@ if (!rflag && time(&tval) == -1) err(1, "time"); - format = "%+"; + format = strdup("%+"); /* allow the operands in any order */ if (*argv && **argv == '+') { diff -ruN date.orig/netdate.c date/netdate.c --- date.orig/netdate.c Fri Nov 23 10:57:45 2001 +++ date/netdate.c Thu Nov 22 19:55:07 2001 @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -74,10 +75,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 +96,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 +144,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 Fri Nov 23 10:57:45 2001 +++ date/vary.c Fri Nov 23 10:57:12 2001 @@ -37,7 +37,7 @@ struct trans { int val; - char *str; + const char *str; }; static struct trans trans_mon[] = { @@ -47,7 +47,7 @@ { -1, NULL } }; -static struct trans trans_wday[] = { +static const struct trans trans_wday[] = { { 0, "sunday" }, { 1, "monday" }, { 2, "tuesday" }, { 3, "wednesday" }, { 4, "thursday" }, { 5, "friday" }, { 6, "saturday" }, { -1, NULL } @@ -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; @@ -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)) --FL5UXtIhxfXey3p5-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Nov 23 5:11:52 2001 Delivered-To: freebsd-audit@freebsd.org Received: from freebsd.org.ru (sweet.etrust.ru [194.84.67.5]) by hub.freebsd.org (Postfix) with ESMTP id D2E6D37B405 for ; Fri, 23 Nov 2001 05:11:40 -0800 (PST) Received: by freebsd.org.ru (Postfix, from userid 1000) id DBDB558; Fri, 23 Nov 2001 16:11:36 +0300 (MSK) Date: Fri, 23 Nov 2001 16:11:36 +0300 From: "Sergey A. Osokin" To: audit@FreeBSD.org Subject: Re: date(1) WARNS=2 cleanup Message-ID: <20011123161136.A11027@freebsd.org.ru> References: <20011123150934.A10406@freebsd.org.ru> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="XsQoSWH+UP9D9v3l" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011123150934.A10406@freebsd.org.ru>; from osa@freebsd.org.ru on Fri, Nov 23, 2001 at 03:09:34PM +0300 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Oops, sorry. This patch is more rightly :-) -- Rgdz, /"\ Sergey Osokin aka oZZ, \ / ASCII RIBBON CAMPAIGN osa@freebsd.org.ru X AGAINST HTML MAIL http://freebsd.org.ru/~osa/ / \ --XsQoSWH+UP9D9v3l Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-date diff -ruN date.orig/Makefile date/Makefile --- date.orig/Makefile Fri Nov 23 10:57:45 2001 +++ date/Makefile Thu Nov 22 18:58:07 2001 @@ -6,4 +6,6 @@ DPADD= ${LIBUTIL} LDADD= -lutil +WARNS?= 2 + .include diff -ruN date.orig/date.c date/date.c --- date.orig/date.c Fri Nov 23 10:57:45 2001 +++ date/date.c Thu Nov 22 19:27:19 2001 @@ -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 *)); int main(argc, argv) @@ -148,7 +148,7 @@ if (!rflag && time(&tval) == -1) err(1, "time"); - format = "%+"; + format = strdup("%+"); /* allow the operands in any order */ if (*argv && **argv == '+') { diff -ruN date.orig/netdate.c date/netdate.c --- date.orig/netdate.c Fri Nov 23 10:57:45 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 Fri Nov 23 10:57:45 2001 +++ date/vary.c Fri Nov 23 13:08:31 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; @@ -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)) --XsQoSWH+UP9D9v3l-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Nov 23 14:17:55 2001 Delivered-To: freebsd-audit@freebsd.org Received: from squigy.ddm.wox.org (p26.argon2.sentex.ca [206.51.25.58]) by hub.freebsd.org (Postfix) with ESMTP id 13AD537B405 for ; Fri, 23 Nov 2001 14:17:51 -0800 (PST) Received: from rama.ddm.wox.org (rama.ddm.wox.org [204.50.152.20]) by squigy.ddm.wox.org (Postfix) with ESMTP id 692D48BAD5; Fri, 23 Nov 2001 17:17:49 -0500 (EST) Received: by rama.ddm.wox.org (Postfix, from userid 5000) id B4CFD32000; Fri, 23 Nov 2001 17:17:05 -0500 (EST) Date: Fri, 23 Nov 2001 17:17:05 -0500 From: Dave Chapeskie To: audit@FreeBSD.ORG Cc: "Sergey A . Osokin" Subject: Re: date(1) WARNS=2 cleanup Message-ID: <20011123171705.A2462@ddm.wox.org> Mail-Followup-To: Dave Chapeskie , audit@FreeBSD.ORG, "Sergey A . Osokin" References: <20011123150934.A10406@freebsd.org.ru> <20011123161136.A11027@freebsd.org.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20011123161136.A11027@freebsd.org.ru>; from osa@freebsd.org.ru on Fri, Nov 23, 2001 at 04:11:36PM +0300 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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 majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Nov 23 22:51:26 2001 Delivered-To: freebsd-audit@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id 424EE37B417 for ; Fri, 23 Nov 2001 22:51:23 -0800 (PST) Received: from localhost (arr@localhost) by fledge.watson.org (8.11.6/8.11.5) with SMTP id fAO6pBU52744 for ; Sat, 24 Nov 2001 01:51:12 -0500 (EST) (envelope-from arr@FreeBSD.org) X-Authentication-Warning: fledge.watson.org: arr owned process doing -bs Date: Sat, 24 Nov 2001 01:51:11 -0500 (EST) From: "Andrew R. Reiter" X-Sender: arr@fledge.watson.org To: freebsd-audit@FreeBSD.org Subject: xtend - unsafe signal handlers patch Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, Due to "maintainers" lack of responding to my patch to fix some poor signal handlers in xtend, I figured I should ship it over here for review (or silence assuming it's ok). The patch is located at: http://people.freebsd.org/~arr/patches/xtend-signal-warns.diff Cheers, Andrew -- Andrew R. Reiter arr@watson.org arr@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Nov 24 2:23: 8 2001 Delivered-To: freebsd-audit@freebsd.org Received: from relay1.ntu-kpi.kiev.ua (www.ntu-kpi.kiev.ua [212.111.192.161]) by hub.freebsd.org (Postfix) with ESMTP id 19E1737B419 for ; Sat, 24 Nov 2001 02:23:04 -0800 (PST) Received: from comsys.ntu-kpi.kiev.ua (eth0.comsys.ntu-kpi.kiev.ua [10.0.1.184]) by relay1.ntu-kpi.kiev.ua (Postfix) with ESMTP id 189792F1B0 for ; Sat, 24 Nov 2001 12:23:00 +0200 (EET) Received: (from root@localhost) by comsys.ntu-kpi.kiev.ua (8.11.6/8.11.6) id fAOAOpE14521 for freebsd-audit@FreeBSD.ORG.CHECKED; Sat, 24 Nov 2001 12:24:51 +0200 (EET) Received: from pm5149 (pm514-9.comsys.ntu-kpi.kiev.ua [10.18.54.109]) by comsys.ntu-kpi.kiev.ua (8.11.6/8.11.6) with SMTP id fAOAOl414513; Sat, 24 Nov 2001 12:24:47 +0200 (EET) Message-ID: <002101c174c9$02805d60$6d36120a@comsys.ntukpi.kiev.ua> From: "Andrey Simonenko" To: "Andrew R. Reiter" Cc: References: Subject: Re: xtend - unsafe signal handlers patch Date: Sat, 24 Nov 2001 12:18:42 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG ----- Original Message ----- From: Andrew R. Reiter Newsgroups: lucky.freebsd.audit Sent: Saturday, November 24, 2001 9:51 AM Subject: xtend - unsafe signal handlers patch > Due to "maintainers" lack of responding to my patch to fix some poor > signal handlers in xtend, I figured I should ship it over here for review > (or silence assuming it's ok). The patch is located at: > http://people.freebsd.org/~arr/patches/xtend-signal-warns.diff > I didn't completely check your patch, but it is better to change type of following variables from: +int hup_flag; /* received SIGHUP flag */ +int term_flag; /* received SIGTERM flag */ +int pipe_flag; /* received SIGPIPE flag */ to +volatile sig_atomic_t hup_flag; /* received SIGHUP flag */ +volatile sig_atomic_t term_flag; /* received SIGTERM flag */ +volatile sig_atomic_t pipe_flag; /* received SIGPIPE flag */ I think, because they are changed in signal handlers. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Nov 24 11:58:56 2001 Delivered-To: freebsd-audit@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id ABFDF37B405 for ; Sat, 24 Nov 2001 11:54:53 -0800 (PST) Received: from localhost (arr@localhost) by fledge.watson.org (8.11.6/8.11.5) with SMTP id fAOJjUD62014; Sat, 24 Nov 2001 14:45:30 -0500 (EST) (envelope-from arr@FreeBSD.org) X-Authentication-Warning: fledge.watson.org: arr owned process doing -bs Date: Sat, 24 Nov 2001 14:45:30 -0500 (EST) From: "Andrew R. Reiter" X-Sender: arr@fledge.watson.org To: Andrey Simonenko Cc: freebsd-audit@FreeBSD.org Subject: Re: xtend - unsafe signal handlers patch In-Reply-To: <002101c174c9$02805d60$6d36120a@comsys.ntukpi.kiev.ua> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, 24 Nov 2001, Andrey Simonenko wrote: : :+volatile sig_atomic_t hup_flag; /* received SIGHUP flag */ :+volatile sig_atomic_t term_flag; /* received SIGTERM flag */ :+volatile sig_atomic_t pipe_flag; /* received SIGPIPE flag */ Yes, this is a correct fix. Thanks ;-) Cheers, Andrew Andrew -- Andrew R. Reiter arr@watson.org arr@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message