summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-06-13 08:52:46 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-06-13 08:52:46 +0000
commit52d9206619e04e5dca7ada0618e60fea74dd0467 (patch)
tree849a7b90b1f36ee4e8df4f9bff1c2dfbb894342c
parent5fcf0e87bd7fdd61b838af3ddda2b5d294a5a567 (diff)
va_start/end for every call to vfprintf and friends, from scp.c
-rw-r--r--bin/rcp/rcp.c24
-rw-r--r--kerberosIV/src/appl/bsd/rcp.c17
-rw-r--r--kerberosV/src/appl/rcp/rcp.c10
3 files changed, 31 insertions, 20 deletions
diff --git a/bin/rcp/rcp.c b/bin/rcp/rcp.c
index 2c1fd243c86..b776f8df6a8 100644
--- a/bin/rcp/rcp.c
+++ b/bin/rcp/rcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcp.c,v 1.20 2001/05/11 18:43:40 mickey Exp $ */
+/* $OpenBSD: rcp.c,v 1.21 2001/06/13 08:52:42 markus Exp $ */
/* $NetBSD: rcp.c,v 1.9 1995/03/21 08:19:06 cgd Exp $ */
/*
@@ -906,23 +906,29 @@ run_err(fmt, va_alist)
{
static FILE *fp;
va_list ap;
-#ifdef __STDC__
- va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
++errs;
if (fp == NULL && !(fp = fdopen(rem, "w")))
return;
(void)fprintf(fp, "%c", 0x01);
(void)fprintf(fp, "rcp: ");
+#ifdef __STDC__
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
(void)vfprintf(fp, fmt, ap);
+ va_end(ap);
(void)fprintf(fp, "\n");
(void)fflush(fp);
- if (!iamremote)
+ if (!iamremote) {
+#ifdef __STDC__
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
vwarnx(fmt, ap);
-
- va_end(ap);
+ va_end(ap);
+ }
}
diff --git a/kerberosIV/src/appl/bsd/rcp.c b/kerberosIV/src/appl/bsd/rcp.c
index 4451233602e..27c8bfb8be8 100644
--- a/kerberosIV/src/appl/bsd/rcp.c
+++ b/kerberosIV/src/appl/bsd/rcp.c
@@ -33,7 +33,7 @@
#include "bsd_locl.h"
-RCSID("$KTH: rcp.c,v 1.52 1999/11/16 16:54:16 bg Exp $");
+RCSID("$KTH: rcp.c,v 1.52.2.1 2000/06/23 02:35:16 assar Exp $");
/* Globals */
static char dst_realm_buf[REALM_SZ];
@@ -145,18 +145,21 @@ run_err(const char *fmt, ...)
char errbuf[1024];
va_list args;
- va_start(args, fmt);
++errs;
#define RCPERR "\001rcp: "
strlcpy (errbuf, RCPERR, sizeof(errbuf));
+ va_start(args, fmt);
vsnprintf (errbuf + strlen(errbuf),
sizeof(errbuf) - strlen(errbuf),
fmt, args);
+ va_end(args);
strlcat (errbuf, "\n", sizeof(errbuf));
des_write (rem, errbuf, strlen(errbuf));
- if (!iamremote)
+ if (!iamremote) {
+ va_start(args, fmt);
vwarnx(fmt, args);
- va_end(args);
+ va_end(args);
+ }
}
static void
@@ -415,7 +418,7 @@ kerberos(char **host, char *bp, char *locuser, char *user)
int sock = -1, err;
if (use_kerberos) {
- setuid(getuid());
+ paranoid_setuid(getuid());
rem = KSUCCESS;
errno = 0;
if (dest_realm == NULL)
@@ -559,7 +562,7 @@ toremote(char *targ, int argc, char **argv)
if (response() < 0)
exit(1);
free(bp);
- setuid(userid);
+ paranoid_setuid(userid);
}
source(1, argv+i);
}
@@ -1002,7 +1005,7 @@ main(int argc, char **argv)
response();
if(do_osfc2_magic(pwd->pw_uid))
exit(1);
- setuid(userid);
+ paranoid_setuid(userid);
if (k_hasafs()) {
/* Sometimes we will need cell specific tokens
* to be able to read and write files, thus,
diff --git a/kerberosV/src/appl/rcp/rcp.c b/kerberosV/src/appl/rcp/rcp.c
index 1c532ad8e50..4c324fb8e3b 100644
--- a/kerberosV/src/appl/rcp/rcp.c
+++ b/kerberosV/src/appl/rcp/rcp.c
@@ -709,21 +709,23 @@ run_err(const char *fmt, ...)
{
static FILE *fp;
va_list ap;
- va_start(ap, fmt);
++errs;
if (fp == NULL && !(fp = fdopen(remout, "w")))
return;
(void)fprintf(fp, "%c", 0x01);
(void)fprintf(fp, "rcp: ");
+ va_start(ap, fmt);
(void)vfprintf(fp, fmt, ap);
+ va_end(ap);
(void)fprintf(fp, "\n");
(void)fflush(fp);
- if (!iamremote)
+ if (!iamremote) {
+ va_start(ap, fmt);
vwarnx(fmt, ap);
-
- va_end(ap);
+ va_end(ap);
+ }
}
/*