Date: Wed, 15 Jun 2005 18:57:36 GMT From: Tilman Linneweh <arved@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/82287: [routed] Fix varargs usage, remove non-existing -p option Message-ID: <200506151857.j5FIvaRY090482@freefall.freebsd.org> Resent-Message-ID: <200506151900.j5FJ0dwF090542@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 82287
>Category: bin
>Synopsis: [routed] Fix varargs usage, remove non-existing -p option
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Wed Jun 15 19:00:38 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Tilman Linneweh
>Release: FreeBSD 4.11-STABLE i386
>Organization:
>Environment:
System: FreeBSD freefall.freebsd.org 4.11-STABLE FreeBSD 4.11-STABLE #16: Sat Feb 26 00:02:03 GMT 2005 kensmith@freefall.freebsd.org:/c/src/sys/compile/FREEFALL i386
>Description:
The varargs handling in routed is broken,
This has been fixed, in rhyolite routed 2.31 and NetBSD, OpenBSD
Attached is a diff against main.c from rhyolite routed 2.31
Additional this patch removes the unimplented, and undocumented -p Option
This fix was committed to the other BSDs some time ago
>How-To-Repeat:
Run routed with -dt on freebsd-amd64
>Fix:
--- patch-routed-main.c begins here ---
--- /usr/src/sbin/routed/main.c Sat Jun 4 13:34:31 2005
+++ main.c Wed Jun 15 19:38:08 2005
@@ -47,8 +47,8 @@
#elif defined(__FreeBSD__)
__RCSID("$FreeBSD: src/sbin/routed/main.c,v 1.18 2005/05/31 20:28:48 stefanf Exp $");
#else
-__RCSID("$Revision: 2.27 $");
-#ident "$Revision: 2.27 $"
+__RCSID("$Revision: 2.31 $");
+#ident "$Revision: 2.31 $"
#endif
pid_t mypid;
@@ -133,7 +133,7 @@
(void)gethostname(myname, sizeof(myname)-1);
(void)gethost(myname, &myaddr);
- while ((n = getopt(argc, argv, "sqdghmpAtvT:F:P:")) != -1) {
+ while ((n = getopt(argc, argv, "sqdghmAtvT:F:P:")) != -1) {
switch (n) {
case 's':
supplier = 1;
@@ -219,7 +219,7 @@
case 'v':
/* display version */
verbose++;
- msglog("version 2.25");
+ msglog("version 2.31");
break;
default:
@@ -237,7 +237,7 @@
goto usage;
if (argc != 0) {
usage:
- logbad(0, "usage: routed [-sqdghmpAtv] [-T tracefile]"
+ logbad(0, "usage: routed [-sqdghmAtv] [-T tracefile]"
" [-F net[,metric]] [-P parms]");
}
if (geteuid() != 0) {
@@ -863,14 +863,16 @@
va_start(args, p);
vsyslog(LOG_ERR, p, args);
+ va_end(args);
if (ftrace != 0) {
if (ftrace == stdout)
(void)fputs("routed: ", ftrace);
+ va_start(args, p);
(void)vfprintf(ftrace, p, args);
+ va_end(args);
(void)fputc('\n', ftrace);
}
- va_end(args);
}
@@ -889,8 +891,6 @@
struct msg_sub *ms1, *ms;
const char *p1;
- va_start(args, p);
-
/* look for the oldest slot in the table
* or the slot for the bad router.
*/
@@ -925,15 +925,18 @@
trace_flush();
for (p1 = p; *p1 == ' '; p1++)
continue;
+ va_start(args, p);
vsyslog(LOG_ERR, p1, args);
+ va_end(args);
}
/* always display the message if tracing */
if (ftrace != 0) {
+ va_start(args, p);
(void)vfprintf(ftrace, p, args);
+ va_end(args);
(void)fputc('\n', ftrace);
}
- va_end(args);
}
@@ -946,12 +949,14 @@
va_start(args, p);
vsyslog(LOG_ERR, p, args);
+ va_end(args);
(void)fputs("routed: ", stderr);
+ va_start(args, p);
(void)vfprintf(stderr, p, args);
+ va_end(args);
(void)fputs("; giving up\n",stderr);
(void)fflush(stderr);
- va_end(args);
if (dump)
abort();
--- patch-routed-main.c ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506151857.j5FIvaRY090482>
