diff options
author | 2006-04-13 16:55:09 +0000 | |
---|---|---|
committer | 2006-04-13 16:55:09 +0000 | |
commit | 7599b6c641156e0b1ed9b916b5f402781932812c (patch) | |
tree | da5e47a87e08b6b9b0b4cb1ed9db114aec6c5fb7 /usr.bin/cvs/diff.c | |
parent | Remove unused variable. (diff) | |
download | wireguard-openbsd-7599b6c641156e0b1ed9b916b5f402781932812c.tar.xz wireguard-openbsd-7599b6c641156e0b1ed9b916b5f402781932812c.zip |
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); } |