From bb82525ea4b980ed8785307a7a0014a6d23f85bd Mon Sep 17 00:00:00 2001 From: Joris Vink Date: Thu, 13 Apr 2006 19:11:31 +0000 Subject: fix the obviously broken cvs_buf_set(), so we don't end up getting our buffer reset to 0 (empty) all the time. i noticed this when i was trying to fix -z for keyword expansion. sigh. okay niallo@ --- usr.bin/cvs/buf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c index eee3c889830..3e8dc28f23f 100644 --- a/usr.bin/cvs/buf.c +++ b/usr.bin/cvs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.47 2006/04/12 07:56:58 ray Exp $ */ +/* $OpenBSD: buf.c,v 1.48 2006/04/13 19:11:30 joris Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau * All rights reserved. @@ -176,13 +176,17 @@ cvs_buf_set(BUF *b, const void *src, size_t len, size_t off) size_t rlen = 0; if (b->cb_size < (len + off)) { - if ((b->cb_flags & BUF_AUTOEXT)) + if ((b->cb_flags & BUF_AUTOEXT)) { cvs_buf_grow(b, len + off - b->cb_size); - else + rlen = len + off; + } else { rlen = b->cb_size - off; - } else + } + } else { rlen = len; + } + b->cb_len = rlen; memcpy((b->cb_buf + off), src, rlen); if (b->cb_len == 0) { -- cgit v1.2.3