You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
952 B
44 lines
952 B
6 years ago
|
--- netkit-rsh-0.10/rcp/rcp.c 1999-04-18 05:16:49-04 1.1
|
||
|
+++ netkit-rsh-0.10/rcp/rcp.c 1999-04-18 05:40:52-04
|
||
|
@@ -836,19 +836,33 @@
|
||
|
error(const char *fmt, ...)
|
||
|
{
|
||
|
static FILE *fp;
|
||
|
- va_list ap;
|
||
|
-
|
||
|
- va_start(ap, fmt);
|
||
|
+ char buf[1000];
|
||
|
|
||
|
++errs;
|
||
|
if (!fp && !(fp = fdopen(rem, "w")))
|
||
|
return;
|
||
|
- fprintf(fp, "%c", 0x01);
|
||
|
- vfprintf(fp, fmt, ap);
|
||
|
+
|
||
|
+ /* (fmt,...) might need to go to two streams.
|
||
|
+ *
|
||
|
+ * In { va_start ; vfprintf ; vfprintf ; va_end }, second
|
||
|
+ * vfprintf didn't restart (ie: vfprintf affects ap) (glibc)
|
||
|
+ *
|
||
|
+ * Is { va_start ; vfprintf ; va_end} * 2 even allowed?
|
||
|
+ *
|
||
|
+ * => Dump (fmt,...) to buffer. */
|
||
|
+
|
||
|
+ {
|
||
|
+ va_list ap;
|
||
|
+ va_start(ap, fmt);
|
||
|
+ vsnprintf(buf, sizeof(buf), fmt, ap);
|
||
|
+ buf[sizeof(buf)-1] = 0;
|
||
|
+ va_end(ap);
|
||
|
+ }
|
||
|
+
|
||
|
+ fprintf(fp, "%c%s", 0x01, buf);
|
||
|
fflush(fp);
|
||
|
- if (!iamremote) vfprintf(stderr, fmt, ap);
|
||
|
|
||
|
- va_end(ap);
|
||
|
+ if (!iamremote) fputs(buf, stderr);
|
||
|
}
|
||
|
|
||
|
static void
|