diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-04-13 16:55:10 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-04-13 16:55:10 +0000 |
commit | 21313cdffdeab10f33ac444fa163fee2c792b6ec (patch) | |
tree | a79e862038e0a8f50dc4d0afa03607dea4397955 /usr.bin/cvs/diff.c | |
parent | 5b89fdbd84ea97dd9fb934d378e10b00a84581ec (diff) |
Add error checking for vasprintf. Stylistic suggestions from xsa@.
OK xsa@
Diffstat (limited to 'usr.bin/cvs/diff.c')
-rw-r--r-- | usr.bin/cvs/diff.c | 9 |
1 files changed, 6 insertions, 3 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); } |