diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2006-04-13 19:11:31 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2006-04-13 19:11:31 +0000 |
commit | bb82525ea4b980ed8785307a7a0014a6d23f85bd (patch) | |
tree | dc80d718de8efa3b5eec8aa3f84403e62aff12a3 | |
parent | 21313cdffdeab10f33ac444fa163fee2c792b6ec (diff) |
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@
-rw-r--r-- | usr.bin/cvs/buf.c | 12 |
1 files 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 <jfb@openbsd.org> * 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) { |