diff options
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/diff.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/diff3.c | 32 | ||||
-rw-r--r-- | usr.bin/cvs/import.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/logmsg.c | 7 | ||||
-rw-r--r-- | usr.bin/cvs/proto.c | 30 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 23 | ||||
-rw-r--r-- | usr.bin/cvs/resp.c | 7 |
7 files changed, 32 insertions, 83 deletions
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c index 019ae38148b..6b833013ba4 100644 --- a/usr.bin/cvs/diff.c +++ b/usr.bin/cvs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.71 2005/12/10 20:27:45 joris Exp $ */ +/* $OpenBSD: diff.c,v 1.72 2005/12/20 18:17:00 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -675,11 +675,7 @@ cvs_diff_local(CVSFILE *cf, void *arg) cvs_printf(" %s\n", diff_file); strlcpy(path_tmp1, cvs_tmpdir, sizeof(path_tmp1)); strlcat(path_tmp1, "/diff1.XXXXXXXXXX", sizeof(path_tmp1)); - if (cvs_buf_write_stmp(b1, path_tmp1, 0600) == -1) { - cvs_buf_free(b1); - cvs_buf_free(b2); - return (CVS_EX_DATA); - } + cvs_buf_write_stmp(b1, path_tmp1, 0600); cvs_buf_free(b1); if (utimes(path_tmp1, (const struct timeval *)&tv) < 0) cvs_log(LP_ERRNO, "error setting utimes"); diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c index 45c39e4a02f..f7939d85c64 100644 --- a/usr.bin/cvs/diff3.c +++ b/usr.bin/cvs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.8 2005/12/10 20:27:45 joris Exp $ */ +/* $OpenBSD: diff3.c,v 1.9 2005/12/20 18:17:01 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -71,7 +71,7 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diff3.c,v 1.8 2005/12/10 20:27:45 joris Exp $"; +static const char rcsid[] = "$OpenBSD: diff3.c,v 1.9 2005/12/20 18:17:01 xsa Exp $"; #endif /* not lint */ #include <sys/queue.h> @@ -197,16 +197,13 @@ cvs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2) goto out; strlcpy(path1, "/tmp/diff1.XXXXXXXXXX", sizeof(path1)); - if (cvs_buf_write_stmp(b1, path1, 0600) == -1) - goto out; + cvs_buf_write_stmp(b1, path1, 0600); strlcpy(path2, "/tmp/diff2.XXXXXXXXXX", sizeof(path2)); - if (cvs_buf_write_stmp(b2, path2, 0600) == -1) - goto out; + cvs_buf_write_stmp(b2, path2, 0600); strlcpy(path3, "/tmp/diff3.XXXXXXXXXX", sizeof(path3)); - if (cvs_buf_write_stmp(b3, path3, 0600) == -1) - goto out; + cvs_buf_write_stmp(b3, path3, 0600); cvs_buf_free(b2); b2 = NULL; @@ -215,15 +212,13 @@ cvs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2) cvs_diffreg(path2, path3, d2); strlcpy(dp13, "/tmp/d13.XXXXXXXXXX", sizeof(dp13)); - if (cvs_buf_write_stmp(d1, dp13, 0600) < 0) - goto out; + cvs_buf_write_stmp(d1, dp13, 0600); cvs_buf_free(d1); d1 = NULL; strlcpy(dp23, "/tmp/d23.XXXXXXXXXX", sizeof(dp23)); - if (cvs_buf_write_stmp(d2, dp23, 0600) < 0) - goto out; + cvs_buf_write_stmp(d2, dp23, 0600); cvs_buf_free(d2); d2 = NULL; @@ -243,17 +238,8 @@ cvs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2) goto out; } - if (cvs_buf_putc(diffb, '\0') < 0) { - cvs_buf_free(diffb); - diffb = NULL; - goto out; - } - - if (cvs_buf_putc(b1, '\0') < 0) { - cvs_buf_free(diffb); - diffb = NULL; - goto out; - } + cvs_buf_putc(diffb, '\0'); + cvs_buf_putc(b1, '\0'); patch = cvs_buf_release(diffb); data = cvs_buf_release(b1); diff --git a/usr.bin/cvs/import.c b/usr.bin/cvs/import.c index 87b73444b09..58f26ec4be9 100644 --- a/usr.bin/cvs/import.c +++ b/usr.bin/cvs/import.c @@ -1,4 +1,4 @@ -/* $OpenBSD: import.c,v 1.31 2005/12/10 20:27:45 joris Exp $ */ +/* $OpenBSD: import.c,v 1.32 2005/12/20 18:17:01 xsa Exp $ */ /* * Copyright (c) 2004 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -371,11 +371,7 @@ cvs_import_local(CVSFILE *cf, void *arg) return (CVS_EX_DATA); } - if (cvs_buf_putc(bp, '\0') < 0) { - rcs_close(rf); - (void)unlink(rpath); - return (CVS_EX_DATA); - } + cvs_buf_putc(bp, '\0'); fcont = cvs_buf_release(bp); diff --git a/usr.bin/cvs/logmsg.c b/usr.bin/cvs/logmsg.c index 1180ede690a..abb11e93f81 100644 --- a/usr.bin/cvs/logmsg.c +++ b/usr.bin/cvs/logmsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logmsg.c,v 1.22 2005/12/10 20:27:45 joris Exp $ */ +/* $OpenBSD: logmsg.c,v 1.23 2005/12/20 18:17:01 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -141,10 +141,7 @@ cvs_logmsg_open(const char *path) } (void)fclose(fp); - if (cvs_buf_putc(bp, '\0') < 0) { - cvs_buf_free(bp); - return (NULL); - } + cvs_buf_putc(bp, '\0'); msg = (char *)cvs_buf_release(bp); diff --git a/usr.bin/cvs/proto.c b/usr.bin/cvs/proto.c index 329fc557884..f477e684aea 100644 --- a/usr.bin/cvs/proto.c +++ b/usr.bin/cvs/proto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proto.c,v 1.80 2005/12/10 20:27:45 joris Exp $ */ +/* $OpenBSD: proto.c,v 1.81 2005/12/20 18:17:01 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -444,19 +444,13 @@ cvs_req_getvalid(void) strlen(cvs_requests[0].req_str), (size_t)0); for (i = 1; i < CVS_NBREQ; i++) { - if ((cvs_buf_putc(buf, ' ') < 0) || - (cvs_buf_append(buf, cvs_requests[i].req_str, - strlen(cvs_requests[i].req_str)) < 0)) { - cvs_buf_free(buf); - return (NULL); - } + cvs_buf_putc(buf, ' '); + cvs_buf_append(buf, cvs_requests[i].req_str, + strlen(cvs_requests[i].req_str)); } /* NUL-terminate */ - if (cvs_buf_putc(buf, '\0') < 0) { - cvs_buf_free(buf); - return (NULL); - } + cvs_buf_putc(buf, '\0'); len = cvs_buf_len(buf); vrstr = (char *)xmalloc(len); @@ -522,19 +516,13 @@ cvs_resp_getvalid(void) strlen(cvs_responses[0].resp_str), (size_t)0); for (i = 1; i < CVS_NBRESP; i++) { - if ((cvs_buf_putc(buf, ' ') < 0) || - (cvs_buf_append(buf, cvs_responses[i].resp_str, - strlen(cvs_responses[i].resp_str)) < 0)) { - cvs_buf_free(buf); - return (NULL); - } + cvs_buf_putc(buf, ' '); + cvs_buf_append(buf, cvs_responses[i].resp_str, + strlen(cvs_responses[i].resp_str)); } /* NUL-terminate */ - if (cvs_buf_putc(buf, '\0') < 0) { - cvs_buf_free(buf); - return (NULL); - } + cvs_buf_putc(buf, '\0'); len = cvs_buf_len(buf); vrstr = (char *)xmalloc(len); diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 3681a4e600b..04d7005788f 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.113 2005/12/20 16:55:21 xsa Exp $ */ +/* $OpenBSD: rcs.c,v 1.114 2005/12/20 18:17:01 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -1257,10 +1257,8 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) return (NULL); } - if (cvs_buf_putc(rbuf, '\0') < 0) { - cvs_buf_free(rbuf); - return (NULL); - } + cvs_buf_putc(rbuf, '\0'); + bp = cvs_buf_release(rbuf); rbuf = cvs_patchfile((char *)bp, (char *)rdp->rd_text, rcs_patch_lines); @@ -1284,10 +1282,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) if ((rdp = rcs_findrev(rfp, rev)) == NULL) return (rbuf); - if (cvs_buf_putc(rbuf, '\0') < 0) { - cvs_buf_free(dbuf); - return (rbuf); - } + cvs_buf_putc(rbuf, '\0'); bp = cvs_buf_release(rbuf); if ((lines = cvs_splitlines((char *)bp)) != NULL) { @@ -2929,12 +2924,7 @@ cvs_checkout_rev(RCSFILE *rf, RCSNUM *rev, CVSFILE *cf, char *fpath, /* XXX move the old file when merging */ case CHECKOUT_REV_UPDATED: case CHECKOUT_REV_CREATED: - if (cvs_buf_write(bp, fpath, cf->cf_mode) < 0) { - cvs_log(LP_ERR, "failed to update file '%s'", - fpath); - goto out; - } - + cvs_buf_write(bp, fpath, cf->cf_mode); /* * correct the time first */ @@ -2973,8 +2963,7 @@ cvs_checkout_rev(RCSFILE *rf, RCSNUM *rev, CVSFILE *cf, char *fpath, fsize = cvs_buf_len(bp); cvs_modetostr(cf->cf_mode, modestr, sizeof(modestr)); - if (cvs_buf_putc(bp, '\0') < 0) - goto out; + cvs_buf_putc(bp, '\0'); content = cvs_buf_release(bp); bp = NULL; } diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c index 713347d12ed..c1d1735e780 100644 --- a/usr.bin/cvs/resp.c +++ b/usr.bin/cvs/resp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resp.c,v 1.64 2005/12/10 20:27:45 joris Exp $ */ +/* $OpenBSD: resp.c,v 1.65 2005/12/20 18:17:01 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -682,10 +682,7 @@ cvs_resp_updated(struct cvsroot *root, int type, char *line) if ((fbuf = cvs_recvfile(root, &fmode)) == NULL) return (-1); - if (cvs_buf_write(fbuf, path, fmode) < 0) { - cvs_buf_free(fbuf); - return (-1); - } + cvs_buf_write(fbuf, path, fmode); cvs_buf_free(fbuf); if (cvs_modtime != CVS_DATE_DMSEC) { |