summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/diff.c9
-rw-r--r--usr.bin/cvs/log.c47
2 files changed, 29 insertions, 27 deletions
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index caeaff903bc..c737b1a013f 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.87 2006/04/05 01:38:55 ray Exp $ */
+/* $OpenBSD: diff.c,v 1.88 2006/04/13 16:55:09 ray Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -1720,14 +1720,17 @@ void
diff_output(const char *fmt, ...)
{
va_list vap;
+ int i;
char *str;
va_start(vap, fmt);
- vasprintf(&str, fmt, vap);
+ i = vasprintf(&str, fmt, vap);
+ va_end(vap);
+ if (i == -1)
+ fatal("diff_output: %s", strerror(errno));
if (diffbuf != NULL)
cvs_buf_append(diffbuf, str, strlen(str));
else
cvs_printf("%s", str);
xfree(str);
- va_end(vap);
}
diff --git a/usr.bin/cvs/log.c b/usr.bin/cvs/log.c
index 9bcbfe2fb91..266334467d4 100644
--- a/usr.bin/cvs/log.c
+++ b/usr.bin/cvs/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.31 2006/03/15 21:34:59 niallo Exp $ */
+/* $OpenBSD: log.c,v 1.32 2006/04/13 16:55:09 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -306,31 +306,30 @@ cvs_printf(const char *fmt, ...)
#if !defined(RCSPROG)
if (cvs_cmdop == CVS_OP_SERVER) {
ret = vasprintf(&nstr, fmt, vap);
- if (ret != -1) {
- for (dp = nstr; *dp != '\0';) {
- sp = strchr(dp, '\n');
- if (sp == NULL)
- for (sp = dp; *sp != '\0'; sp++)
- ;
-
- if (send_m) {
- send_m = 0;
- putc('M', stdout);
- putc(' ', stdout);
- }
-
- fwrite(dp, sizeof(char), (size_t)(sp - dp),
- stdout);
-
- if (*sp != '\n')
- break;
-
- putc('\n', stdout);
- send_m = 1;
- dp = sp + 1;
+ if (ret == -1)
+ fatal("cvs_printf: %s", strerror(errno));
+ for (dp = nstr; *dp != '\0';) {
+ sp = strchr(dp, '\n');
+ if (sp == NULL)
+ for (sp = dp; *sp != '\0'; sp++)
+ ;
+
+ if (send_m) {
+ send_m = 0;
+ putc('M', stdout);
+ putc(' ', stdout);
}
- xfree(nstr);
+
+ fwrite(dp, sizeof(char), (size_t)(sp - dp), stdout);
+
+ if (*sp != '\n')
+ break;
+
+ putc('\n', stdout);
+ send_m = 1;
+ dp = sp + 1;
}
+ xfree(nstr);
} else
#endif
ret = vprintf(fmt, vap);