diff options
27 files changed, 149 insertions, 71 deletions
diff --git a/bin/pax/tty_subs.c b/bin/pax/tty_subs.c index 0137e21bcbb..7e3b2d88e18 100644 --- a/bin/pax/tty_subs.c +++ b/bin/pax/tty_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_subs.c,v 1.6 1999/08/09 22:22:52 pjanzen Exp $ */ +/* $OpenBSD: tty_subs.c,v 1.7 2001/09/05 22:32:27 deraadt Exp $ */ /* $NetBSD: tty_subs.c,v 1.5 1995/03/21 09:07:52 cgd Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)tty_subs.c 8.2 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: tty_subs.c,v 1.6 1999/08/09 22:22:52 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: tty_subs.c,v 1.7 2001/09/05 22:32:27 deraadt Exp $"; #endif #endif /* not lint */ @@ -126,8 +126,10 @@ tty_prnt(fmt, va_alist) # else va_start(ap); # endif - if (ttyoutf == NULL) + if (ttyoutf == NULL) { + va_end(ap); return; + } (void)vfprintf(ttyoutf, fmt, ap); va_end(ap); (void)fflush(ttyoutf); diff --git a/games/sail/pl_7.c b/games/sail/pl_7.c index 87032aacb48..c78e068f47b 100644 --- a/games/sail/pl_7.c +++ b/games/sail/pl_7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pl_7.c,v 1.3 2000/01/03 23:22:41 pjanzen Exp $ */ +/* $OpenBSD: pl_7.c,v 1.4 2001/09/05 22:32:28 deraadt Exp $ */ /* $NetBSD: pl_7.c,v 1.6 1995/04/22 10:37:17 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93"; #else -static char rcsid[] = "$OpenBSD: pl_7.c,v 1.3 2000/01/03 23:22:41 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: pl_7.c,v 1.4 2001/09/05 22:32:28 deraadt Exp $"; #endif #endif /* not lint */ @@ -187,8 +187,10 @@ Signal(va_alist) #else va_start(ap, ship); #endif - if (!done_curses) + if (!done_curses) { + va_end(va); return; + } if (*fmt == '\7') putchar(*fmt++); fmtship(format, sizeof(format), fmt, ship); @@ -220,8 +222,10 @@ Msg(va_alist) va_start(ap, fmt); #endif - if (!done_curses) + if (!done_curses) { + va_end(ap); return; + } if (*fmt == '\7') putchar(*fmt++); #ifdef __STDC__ diff --git a/gnu/usr.bin/perl/x2p/util.c b/gnu/usr.bin/perl/x2p/util.c index ab24808d73b..0da649a23ec 100644 --- a/gnu/usr.bin/perl/x2p/util.c +++ b/gnu/usr.bin/perl/x2p/util.c @@ -1,11 +1,14 @@ -/* $RCSfile: util.c,v $$Revision: 4.1 $$Date: 92/08/07 18:29:29 $ +/* $RCSfile: util.c,v $$Revision: 1.5 $$Date: 2001/05/24 18:36:41 $ * * Copyright (c) 1991-2001, Larry Wall * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * - * $Log: util.c,v $ + * $Log: util.c,v $ + * Revision 1.5 2001/05/24 18:36:41 millert + * merge in perl 5.6.1 with our local changes + * */ #include "EXTERN.h" @@ -183,6 +186,7 @@ croak(char *pat,...) va_start(args, pat); vfprintf(stderr,pat,args); + va_end(args); #else fprintf(stderr,pat,a1,a2,a3,a4); #endif @@ -197,6 +201,7 @@ fatal(char *pat,...) va_start(args, pat); vfprintf(stderr,pat,args); + va_end(args); #else fprintf(stderr,pat,a1,a2,a3,a4); #endif @@ -214,6 +219,7 @@ warn(char *pat,...) va_start(args, pat); vfprintf(stderr,pat,args); + va_end(args); #else fprintf(stderr,pat,a1,a2,a3,a4); #endif diff --git a/gnu/usr.sbin/sendmail/mail.local/mail.local.c b/gnu/usr.sbin/sendmail/mail.local/mail.local.c index 5b346d565d3..971273a12f0 100644 --- a/gnu/usr.sbin/sendmail/mail.local/mail.local.c +++ b/gnu/usr.sbin/sendmail/mail.local/mail.local.c @@ -1442,6 +1442,7 @@ mailerr(hdr, fmt, va_alist) } } (void) vsnprintf(&ErrBuf[len], sizeof ErrBuf - len, fmt, ap); + va_end(ap); if (!HoldErrs) flush_error(); diff --git a/kerberosIV/src/appl/ftp/ftp/ftp.c b/kerberosIV/src/appl/ftp/ftp/ftp.c index 300866ddfda..b78f9b8e731 100644 --- a/kerberosIV/src/appl/ftp/ftp/ftp.c +++ b/kerberosIV/src/appl/ftp/ftp/ftp.c @@ -32,7 +32,7 @@ */ #include "ftp_locl.h" -RCSID ("$KTH: ftp.c,v 1.60 1999/10/28 19:32:17 assar Exp $"); +RCSID ("$KTH: ftp.c,v 1.60.2.1 2000/06/23 02:45:40 assar Exp $"); struct sockaddr_storage hisctladdr_ss; struct sockaddr *hisctladdr = (struct sockaddr *)&hisctladdr_ss; @@ -193,8 +193,9 @@ login (char *host) printf ("Name (%s:%s): ", host, myname); else printf ("Name (%s): ", host); - fgets (tmp, sizeof (tmp) - 1, stdin); - tmp[strlen (tmp) - 1] = '\0'; + *tmp = '\0'; + if (fgets (tmp, sizeof (tmp) - 1, stdin) != NULL) + tmp[strlen (tmp) - 1] = '\0'; if (*tmp == '\0') user = myname; else @@ -203,24 +204,26 @@ login (char *host) strlcpy(username, user, sizeof(username)); n = command("USER %s", user); if (n == CONTINUE) { - if(sec_complete) - pass = myname; - else if (pass == NULL) { + if (pass == NULL) { char prompt[128]; if(myname && - (!strcmp(user, "ftp") || !strcmp(user, "anonymous"))){ + (!strcmp(user, "ftp") || !strcmp(user, "anonymous"))) { snprintf(defaultpass, sizeof(defaultpass), "%s@%s", myname, mydomain); snprintf(prompt, sizeof(prompt), "Password (%s): ", defaultpass); - }else{ + } else if (sec_complete) { + pass = myname; + } else { *defaultpass = '\0'; snprintf(prompt, sizeof(prompt), "Password: "); } - pass = defaultpass; - des_read_pw_string (tmp, sizeof (tmp), prompt, 0); - if (tmp[0]) - pass = tmp; + if (pass == NULL) { + pass = defaultpass; + des_read_pw_string (tmp, sizeof (tmp), prompt, 0); + if (tmp[0]) + pass = tmp; + } } n = command ("PASS %s", pass); } @@ -282,6 +285,7 @@ command (char *fmt,...) printf("PASS XXXX"); else vfprintf(stdout, fmt, ap); + va_end(ap); va_start(ap, fmt); } sec_vfprintf(cout, fmt, ap); diff --git a/kerberosV/src/appl/ftp/ftp/ftp.c b/kerberosV/src/appl/ftp/ftp/ftp.c index 8dbeb301f1d..f5d328c3726 100644 --- a/kerberosV/src/appl/ftp/ftp/ftp.c +++ b/kerberosV/src/appl/ftp/ftp/ftp.c @@ -284,6 +284,7 @@ command (char *fmt,...) printf("PASS XXXX"); else vfprintf(stdout, fmt, ap); + va_end(ap); va_start(ap, fmt); } sec_vfprintf(cout, fmt, ap); diff --git a/lib/libc/stdio/asprintf.c b/lib/libc/stdio/asprintf.c index fd0ba320c8f..f08e6c96f42 100644 --- a/lib/libc/stdio/asprintf.c +++ b/lib/libc/stdio/asprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asprintf.c,v 1.6 1998/10/16 16:11:55 millert Exp $ */ +/* $OpenBSD: asprintf.c,v 1.7 2001/09/05 22:32:33 deraadt Exp $ */ /* * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: asprintf.c,v 1.6 1998/10/16 16:11:55 millert Exp $"; +static char rcsid[] = "$OpenBSD: asprintf.c,v 1.7 2001/09/05 22:32:33 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -70,14 +70,15 @@ asprintf(str, fmt, va_alist) if (ret == -1) goto err; *f._p = '\0'; - va_end(ap); _base = realloc(f._bf._base, ret + 1); if (_base == NULL) goto err; *str = (char *)_base; + va_end(ap); return (ret); err: + va_end(ap); if (f._bf._base) { free(f._bf._base); f._bf._base = NULL; diff --git a/lib/libocurses/ctrace.c b/lib/libocurses/ctrace.c index 4f53906cc5e..5f659454f95 100644 --- a/lib/libocurses/ctrace.c +++ b/lib/libocurses/ctrace.c @@ -67,8 +67,10 @@ __CTRACE(fmt, va_alist) #endif if (tracefp == NULL) tracefp = fopen(TFILE, "w"); - if (tracefp == NULL) + if (tracefp == NULL) { + va_end(ap); return; + } (void)vfprintf(tracefp, fmt, ap); va_end(ap); (void)fflush(tracefp); diff --git a/lib/libutil/scsi.c b/lib/libutil/scsi.c index f5af3dbfd39..b7a6d66df36 100644 --- a/lib/libutil/scsi.c +++ b/lib/libutil/scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsi.c,v 1.2 1996/07/31 09:25:48 niklas Exp $ */ +/* $OpenBSD: scsi.c,v 1.3 2001/09/05 22:32:36 deraadt Exp $ */ /* Copyright (c) 1994 HD Associates * (contact: dufault@hda.com) @@ -355,31 +355,42 @@ char *fmt, va_list ap) int scsireq_decode(scsireq_t *scsireq, char *fmt, ...) { va_list ap; + int ret; + va_start (ap, fmt); - return do_buff_decode(scsireq->databuf, (size_t)scsireq->datalen, + ret = do_buff_decode(scsireq->databuf, (size_t)scsireq->datalen, 0, 0, fmt, ap); + va_end (ap); + return (ret); } int scsireq_decode_visit(scsireq_t *scsireq, char *fmt, void (*arg_put)(void *, int , void *, int, char *), void *puthook) { va_list ap; - return do_buff_decode(scsireq->databuf, (size_t)scsireq->datalen, + int ret; + + ret = do_buff_decode(scsireq->databuf, (size_t)scsireq->datalen, arg_put, puthook, fmt, ap); + va_end (ap); + return (ret); } int scsireq_buff_decode(u_char *buff, size_t len, char *fmt, ...) { va_list ap; + int ret; + va_start (ap, fmt); - return do_buff_decode(buff, len, 0, 0, fmt, ap); + ret = do_buff_decode(buff, len, 0, 0, fmt, ap); + va_end (ap); + return (ret); } int scsireq_buff_decode_visit(u_char *buff, size_t len, char *fmt, void (*arg_put)(void *, int, void *, int, char *), void *puthook) { - va_list ap; - return do_buff_decode(buff, len, arg_put, puthook, fmt, ap); + return do_buff_decode(buff, len, arg_put, puthook, fmt, NULL); } /* next_field: Return the next field in a command specifier. This @@ -789,6 +800,7 @@ scsireq_t *scsireq_build(scsireq_t *scsireq, if (do_encode(scsireq->cmd, CMD_BUFLEN, &cmdlen, 0, 0, cmd_spec, ap) == -1) return 0; + va_end (ap); scsireq->cmdlen = cmdlen; return scsireq; @@ -837,14 +849,17 @@ scsireq_t int scsireq_encode(scsireq_t *scsireq, char *fmt, ...) { va_list ap; + int ret; if (scsireq == 0) return 0; va_start(ap, fmt); - return do_encode(scsireq->databuf, + ret = do_encode(scsireq->databuf, scsireq->datalen, 0, 0, 0, fmt, ap); + va_end (ap); + return (ret); } int scsireq_buff_encode_visit(u_char *buff, size_t len, char *fmt, @@ -852,7 +867,7 @@ int scsireq_buff_encode_visit(u_char *buff, size_t len, char *fmt, { va_list ap; return do_encode(buff, len, 0, - arg_get, gethook, fmt, ap); + arg_get, gethook, fmt, ap); } int scsireq_encode_visit(scsireq_t *scsireq, char *fmt, @@ -860,7 +875,7 @@ int scsireq_encode_visit(scsireq_t *scsireq, char *fmt, { va_list ap; return do_encode(scsireq->databuf, scsireq->datalen, 0, - arg_get, gethook, fmt, ap); + arg_get, gethook, fmt, ap); } FILE *scsi_debug_output(char *s) diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index d41754d26aa..22fdf78ffc2 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.103 2001/07/08 21:18:07 deraadt Exp $ */ +/* $OpenBSD: ftpd.c,v 1.104 2001/09/05 22:32:36 deraadt Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -73,7 +73,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; #else -static char rcsid[] = "$OpenBSD: ftpd.c,v 1.103 2001/07/08 21:18:07 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ftpd.c,v 1.104 2001/09/05 22:32:36 deraadt Exp $"; #endif #endif /* not lint */ @@ -1866,6 +1866,7 @@ reply(n, fmt, va_alist) } (void)fflush(stdout); free(buf); + va_end(ap); } void diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c index 8592a841927..697b7cc4452 100644 --- a/libexec/rshd/rshd.c +++ b/libexec/rshd/rshd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rshd.c,v 1.39 2001/07/09 07:04:44 deraadt Exp $ */ +/* $OpenBSD: rshd.c,v 1.40 2001/09/05 22:32:36 deraadt Exp $ */ /*- * Copyright (c) 1988, 1989, 1992, 1993, 1994 @@ -41,7 +41,7 @@ static char copyright[] = #ifndef lint /* from: static char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94"; */ -static char *rcsid = "$OpenBSD: rshd.c,v 1.39 2001/07/09 07:04:44 deraadt Exp $"; +static char *rcsid = "$OpenBSD: rshd.c,v 1.40 2001/09/05 22:32:36 deraadt Exp $"; #endif /* not lint */ /* @@ -792,6 +792,7 @@ error(fmt, va_alist) len = 0; (void)vsnprintf(bp, sizeof(buf) - len, fmt, ap); (void)write(STDERR_FILENO, buf, len + strlen(bp)); + va_end(ap); } void diff --git a/sbin/fsck_msdos/main.c b/sbin/fsck_msdos/main.c index 99394332a55..aec6ae0acad 100644 --- a/sbin/fsck_msdos/main.c +++ b/sbin/fsck_msdos/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.9 2000/01/22 20:24:57 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.10 2001/09/05 22:32:37 deraadt Exp $ */ /* $NetBSD: main.c,v 1.8 1996/10/17 20:29:53 cgd Exp $ */ /* @@ -35,7 +35,7 @@ #ifndef lint -static char rcsid[] = "$OpenBSD: main.c,v 1.9 2000/01/22 20:24:57 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.10 2001/09/05 22:32:37 deraadt Exp $"; #endif /* not lint */ #include <stdlib.h> @@ -145,6 +145,7 @@ ask(def, fmt, va_alist) va_start(ap); #endif vsnprintf(prompt, sizeof(prompt), fmt, ap); + va_end(ap); if (alwaysyes || rdonly) { printf("%s? %s\n", prompt, rdonly ? "no" : "yes"); return (!rdonly); diff --git a/sbin/restore/utilities.c b/sbin/restore/utilities.c index 3fadb401fb7..33e19a8341b 100644 --- a/sbin/restore/utilities.c +++ b/sbin/restore/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.5 1997/08/24 08:07:25 downsj Exp $ */ +/* $OpenBSD: utilities.c,v 1.6 2001/09/05 22:32:37 deraadt Exp $ */ /* $NetBSD: utilities.c,v 1.11 1997/03/19 08:42:56 lukem Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.4 (Berkeley) 10/18/94"; #else -static char rcsid[] = "$OpenBSD: utilities.c,v 1.5 1997/08/24 08:07:25 downsj Exp $"; +static char rcsid[] = "$OpenBSD: utilities.c,v 1.6 2001/09/05 22:32:37 deraadt Exp $"; #endif #endif /* not lint */ @@ -426,6 +426,7 @@ panic(fmt, va_alist) #endif vfprintf(stderr, fmt, ap); + va_end(ap); if (yflag) return; if (reply("abort") == GOOD) { diff --git a/sbin/routed/trace.c b/sbin/routed/trace.c index 9fb65f2e23f..45ef94f5189 100644 --- a/sbin/routed/trace.c +++ b/sbin/routed/trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trace.c,v 1.8 1997/07/30 23:28:46 deraadt Exp $ */ +/* $OpenBSD: trace.c,v 1.9 2001/09/05 22:32:38 deraadt Exp $ */ /* $NetBSD: trace.c,v 1.13 1995/06/20 22:28:03 christos Exp $ */ /* @@ -37,7 +37,7 @@ #if !defined(lint) static char sccsid[] = "@(#)trace.c 8.1 (Berkeley) 6/5/93"; #else -static char rcsid[] = "$OpenBSD: trace.c,v 1.8 1997/07/30 23:28:46 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: trace.c,v 1.9 2001/09/05 22:32:38 deraadt Exp $"; #endif #define RIPCMDS @@ -134,6 +134,7 @@ tmsg(char *p, ...) va_start(args, p); vfprintf(ftrace, p, args); fflush(ftrace); + va_end(args); } } @@ -181,6 +182,7 @@ trace_off(char *p, ...) va_start(args, p); vfprintf(ftrace, p, args); fflush(ftrace); + va_end(args); } trace_close(); @@ -591,6 +593,7 @@ trace_kernel(char *p, ...) lastlog(); va_start(args, p); vfprintf(ftrace, p, args); + va_end(args); } @@ -607,6 +610,7 @@ trace_act(char *p, ...) lastlog(); va_start(args, p); vfprintf(ftrace, p, args); + va_end(args); } @@ -623,6 +627,7 @@ trace_pkt(char *p, ...) lastlog(); va_start(args, p); vfprintf(ftrace, p, args); + va_end(args); } diff --git a/sys/arch/amiga/stand/device-streams/util.c b/sys/arch/amiga/stand/device-streams/util.c index 360ece26752..3275be828cd 100644 --- a/sys/arch/amiga/stand/device-streams/util.c +++ b/sys/arch/amiga/stand/device-streams/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.2 2001/07/04 08:44:59 niklas Exp $ */ +/* $OpenBSD: util.c,v 1.3 2001/09/05 22:32:38 deraadt Exp $ */ /* -------------------------------------------------- | NAME @@ -236,6 +236,7 @@ ask_bool (int def, int other, char *f, ...) va_start (ap, f); vfprintf (mout, f, ap); fprintf (mout, "? [%lc%lc]:",toupper (def),tolower (other)); + va_end (ap); fflush (mout); if (fgets (buffer, 18, min)) { char *s = stripws (buffer); @@ -287,6 +288,7 @@ verbose_message (char *f, ...) va_start (ap, f); vfprintf (mout, f, ap); fprintf (mout, "\n"); + va_end (ap); } } @@ -299,6 +301,7 @@ debug_message (char *f, ...) fprintf (mout, "debug: "); vfprintf (mout, f, ap); fprintf (mout, "\n"); + va_end (ap); } } @@ -311,6 +314,7 @@ verbose_debug_message (char *f, ...) fprintf (mout, "debug: "); vfprintf (mout, f, ap); fprintf (mout, "\n"); + va_end (ap); } } @@ -321,6 +325,7 @@ message (char *f, ...) va_start (ap, f); vfprintf (mout, f, ap); fprintf (mout, "\n"); + va_end (ap); } void @@ -331,6 +336,7 @@ warn_message (char *f, ...) fprintf (mout, "warn: "); vfprintf (mout, f, ap); fprintf (mout, "\n"); + va_end (ap); } void diff --git a/sys/arch/macppc/macppc/opendev.c b/sys/arch/macppc/macppc/opendev.c index c27aad313ef..431d82ed98b 100644 --- a/sys/arch/macppc/macppc/opendev.c +++ b/sys/arch/macppc/macppc/opendev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: opendev.c,v 1.1 2001/09/01 15:44:20 drahn Exp $ */ +/* $OpenBSD: opendev.c,v 1.2 2001/09/05 22:32:38 deraadt Exp $ */ /* $NetBSD: openfirm.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */ /* @@ -136,10 +136,14 @@ OF_call_method(method, ihandle, nargs, nreturns, va_alist) for (ip = args.args_n_results + (n = nargs); --n >= 0;) *--ip = va_arg(ap, int); ofw_stack(); - if (openfirmware(&args) == -1) + if (openfirmware(&args) == -1) { + va_end(ap); return -1; - if (args.args_n_results[nargs]) + } + if (args.args_n_results[nargs]) { + va_end(ap); return args.args_n_results[nargs]; + } for (ip = args.args_n_results + nargs + (n = args.nreturns); --n > 0;) *va_arg(ap, int *) = *--ip; va_end(ap); @@ -181,10 +185,14 @@ OF_call_method_1(method, ihandle, nargs, va_alist) *--ip = va_arg(ap, int); va_end(ap); ofw_stack(); - if (openfirmware(&args) == -1) + if (openfirmware(&args) == -1) { + va_end(ap); return -1; - if (args.args_n_results[nargs]) + } + if (args.args_n_results[nargs]) { + va_end(ap); return -1; + } return args.args_n_results[nargs + 1]; } diff --git a/sys/arch/macppc/stand/Locore.c b/sys/arch/macppc/stand/Locore.c index e43d875d36c..16255a14ffd 100644 --- a/sys/arch/macppc/stand/Locore.c +++ b/sys/arch/macppc/stand/Locore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: Locore.c,v 1.1 2001/09/01 15:39:02 drahn Exp $ */ +/* $OpenBSD: Locore.c,v 1.2 2001/09/05 22:32:39 deraadt Exp $ */ /* $NetBSD: Locore.c,v 1.1 1997/04/16 20:29:11 thorpej Exp $ */ /* @@ -543,10 +543,14 @@ OF_call_method(method, ihandle, nargs, nreturns, va_alist) for (ip = args.args_n_results + (n = nargs); --n >= 0;) *--ip = va_arg(ap, int); - if (openfirmware(&args) == -1) + if (openfirmware(&args) == -1) { + va_end(ap); return -1; - if (args.args_n_results[nargs]) + } + if (args.args_n_results[nargs]) { + va_end(ap); return args.args_n_results[nargs]; + } for (ip = args.args_n_results + nargs + (n = args.nreturns); --n > 0;) *va_arg(ap, int *) = *--ip; va_end(ap); diff --git a/sys/arch/sparc64/sparc64/openfirm.c b/sys/arch/sparc64/sparc64/openfirm.c index 5c8c7603b29..d4a3249732c 100644 --- a/sys/arch/sparc64/sparc64/openfirm.c +++ b/sys/arch/sparc64/sparc64/openfirm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openfirm.c,v 1.3 2001/08/24 00:03:23 art Exp $ */ +/* $OpenBSD: openfirm.c,v 1.4 2001/09/05 22:32:39 deraadt Exp $ */ /* $NetBSD: openfirm.c,v 1.13 2001/06/21 00:08:02 eeh Exp $ */ /* @@ -355,10 +355,14 @@ OF_call_method(method, ihandle, nargs, nreturns, va_alist) va_start(ap, nreturns); for (ip = (long*)(args.args_n_results + (n = nargs)); --n >= 0;) *--ip = va_arg(ap, unsigned long); - if (openfirmware(&args) == -1) + if (openfirmware(&args) == -1) { + va_end(ap); return -1; - if (args.args_n_results[nargs]) + } + if (args.args_n_results[nargs]) { + va_end(ap); return args.args_n_results[nargs]; + } for (ip = (long*)(args.args_n_results + nargs + (n = args.nreturns)); --n > 0;) *va_arg(ap, unsigned long *) = *--ip; va_end(ap); @@ -398,10 +402,14 @@ OF_call_method_1(method, ihandle, nargs, va_alist) for (ip = (long*)(args.args_n_results + (n = nargs)); --n >= 0;) *--ip = va_arg(ap, unsigned long); va_end(ap); - if (openfirmware(&args) == -1) + if (openfirmware(&args) == -1) { + va_end(ap); return -1; - if (args.args_n_results[nargs]) + } + if (args.args_n_results[nargs]) { + va_end(ap); return -1; + } return args.args_n_results[nargs + 1]; } diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 6d24ef3e021..8ac3904b2ae 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.34 2001/09/05 19:22:23 deraadt Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.35 2001/09/05 22:32:39 deraadt Exp $ */ /* $NetBSD: subr_prf.c,v 1.45 1997/10/24 18:14:25 chuck Exp $ */ /*- @@ -203,6 +203,7 @@ panic(fmt, va_alist) vsprintf(panicbuf, fmt, ap); panicstr = panicbuf; } + va_end(ap); printf("panic: "); va_start(ap, fmt); @@ -252,8 +253,8 @@ log(level, fmt, va_alist) logpri(level); /* log the level first */ va_start(ap, fmt); kprintf(fmt, TOLOG, NULL, NULL, ap); - splx(s); va_end(ap); + splx(s); if (!log_open) { va_start(ap, fmt); kprintf(fmt, TOCONS, NULL, NULL, ap); @@ -299,8 +300,8 @@ addlog(fmt, va_alist) s = splhigh(); va_start(ap, fmt); kprintf(fmt, TOLOG, NULL, NULL, ap); - splx(s); va_end(ap); + splx(s); if (!log_open) { va_start(ap, fmt); kprintf(fmt, TOCONS, NULL, NULL, ap); diff --git a/sys/netiso/tp_cons.c b/sys/netiso/tp_cons.c index d5cb50ee216..f4792d91283 100644 --- a/sys/netiso/tp_cons.c +++ b/sys/netiso/tp_cons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tp_cons.c,v 1.5 2001/06/27 03:49:54 angelos Exp $ */ +/* $OpenBSD: tp_cons.c,v 1.6 2001/09/05 22:32:40 deraadt Exp $ */ /* $NetBSD: tp_cons.c,v 1.8 1996/02/14 21:32:37 christos Exp $ */ /*- @@ -239,7 +239,7 @@ tpcons_input(m, va_alist) faddr = va_arg(ap, struct sockaddr *); laddr = va_arg(ap, struct sockaddr *); channel = va_arg(ap, caddr_t); - + va_end(ap); m = (struct mbuf *) tp_inputprep(m); diff --git a/usr.bin/make/error.c b/usr.bin/make/error.c index f2624f91dcd..8bcd6363cee 100644 --- a/usr.bin/make/error.c +++ b/usr.bin/make/error.c @@ -1,5 +1,5 @@ /* $OpenPackages$ */ -/* $OpenBSD: error.c,v 1.8 2001/07/18 14:49:13 espie Exp $ */ +/* $OpenBSD: error.c,v 1.9 2001/09/05 22:32:41 deraadt Exp $ */ /* * Copyright (c) 2001 Marc Espie. @@ -232,5 +232,6 @@ Parse_Error(va_alist) #endif ParseVErrorInternal(Parse_Getfilename(), Parse_Getlineno(), type, fmt, ap); + va_end(va); } diff --git a/usr.bin/more/more.c b/usr.bin/more/more.c index 8d00f0fcd9f..b3d4f4a3be5 100644 --- a/usr.bin/more/more.c +++ b/usr.bin/more/more.c @@ -1,4 +1,4 @@ -/* $OpenBSD: more.c,v 1.13 2001/09/04 23:35:59 millert Exp $ */ +/* $OpenBSD: more.c,v 1.14 2001/09/05 22:32:41 deraadt Exp $ */ /*- * Copyright (c) 1980 The Regents of the University of California. * All rights reserved. @@ -1438,8 +1438,8 @@ va_dcl va_start(argp); execvp (cmd, argp); write (2, "exec failed\n", 12); - exit (1); va_end(argp); /* balance {}'s for some UNIX's */ + exit (1); } if (id > 0) { signal (SIGINT, SIG_IGN); diff --git a/usr.bin/oldrdist/server.c b/usr.bin/oldrdist/server.c index 21afe62243f..fa519e27a66 100644 --- a/usr.bin/oldrdist/server.c +++ b/usr.bin/oldrdist/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.13 2001/07/09 07:04:50 deraadt Exp $ */ +/* $OpenBSD: server.c,v 1.14 2001/09/05 22:32:42 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 @@ -35,7 +35,7 @@ #ifndef lint /* from: static char sccsid[] = "@(#)server.c 8.1 (Berkeley) 6/9/93"; */ -static char *rcsid = "$OpenBSD: server.c,v 1.13 2001/07/09 07:04:50 deraadt Exp $"; +static char *rcsid = "$OpenBSD: server.c,v 1.14 2001/09/05 22:32:42 deraadt Exp $"; #endif /* not lint */ #include <sys/wait.h> @@ -1539,6 +1539,7 @@ fatal(fmt, va_alist) (void) vfprintf(lfp, fmt, ap); fflush(lfp); } + va_end(ap); cleanup(0); } diff --git a/usr.sbin/map-mbone/mapper.c b/usr.sbin/map-mbone/mapper.c index 30dd6c52ef8..531ffa15b69 100644 --- a/usr.sbin/map-mbone/mapper.c +++ b/usr.sbin/map-mbone/mapper.c @@ -203,6 +203,7 @@ log(severity, syserr, format, va_alist) strcat(fmt, "warning - "); strncat(fmt, format, 80); vfprintf(stderr, fmt, ap); + va_end(ap); if (syserr == 0) fprintf(stderr, "\n"); else if (syserr < sys_nerr) diff --git a/usr.sbin/mrinfo/mrinfo.c b/usr.sbin/mrinfo/mrinfo.c index d5b76204a59..2bf1c403584 100644 --- a/usr.sbin/mrinfo/mrinfo.c +++ b/usr.sbin/mrinfo/mrinfo.c @@ -176,6 +176,7 @@ log(severity, syserr, format, va_alist) strcat(fmt, "warning - "); strncat(fmt, format, 80); vfprintf(stderr, fmt, ap); + va_end(ap); if (syserr == 0) fputc('\n', stderr); else if (syserr < sys_nerr) diff --git a/usr.sbin/mtrace/mtrace.c b/usr.sbin/mtrace/mtrace.c index 372b77339da..16f97a4ddba 100644 --- a/usr.sbin/mtrace/mtrace.c +++ b/usr.sbin/mtrace/mtrace.c @@ -52,7 +52,7 @@ #ifndef lint static char rcsid[] = - "@(#) $Id: mtrace.c,v 1.7 2001/07/27 20:34:36 pvalchev Exp $"; + "@(#) $Id: mtrace.c,v 1.8 2001/09/05 22:32:45 deraadt Exp $"; #endif #include <netdb.h> @@ -1708,6 +1708,7 @@ log(severity, syserr, format, va_alist) if (severity == LOG_WARNING) strcat(fmt, "warning - "); strncat(fmt, format, 80); vfprintf(stderr, fmt, ap); + va_end(ap); if (syserr == 0) fprintf(stderr, "\n"); else if(syserr < sys_nerr) diff --git a/usr.sbin/pppd/chat/chat.c b/usr.sbin/pppd/chat/chat.c index 8f8e2426153..c61cbf56974 100644 --- a/usr.sbin/pppd/chat/chat.c +++ b/usr.sbin/pppd/chat/chat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chat.c,v 1.12 1999/12/02 02:32:29 d Exp $ */ +/* $OpenBSD: chat.c,v 1.13 2001/09/05 22:32:46 deraadt Exp $ */ /* * Chat -- a program for automatic session establishment (i.e. dial @@ -83,7 +83,7 @@ #if 0 static char rcsid[] = "Id: chat.c,v 1.19 1998/03/24 23:57:48 paulus Exp $"; #else -static char rcsid[] = "$OpenBSD: chat.c,v 1.12 1999/12/02 02:32:29 d Exp $"; +static char rcsid[] = "$OpenBSD: chat.c,v 1.13 2001/09/05 22:32:46 deraadt Exp $"; #endif #endif @@ -462,6 +462,7 @@ void logf __V((const char *fmt, ...)) #endif vfmtmsg(line, sizeof(line), fmt, args); + va_end(args); if (to_log) syslog(LOG_INFO, "%s", line); if (to_stderr) |