summaryrefslogtreecommitdiffstats
path: root/contrib/csup
diff options
context:
space:
mode:
authorlulf <lulf@FreeBSD.org>2008-11-19 14:57:00 +0000
committerlulf <lulf@FreeBSD.org>2008-11-19 14:57:00 +0000
commitb389e1bc700b4a28122ab88274772ce7759c10ac (patch)
tree0b21b52c8165dcd04fd5efcec776a74544e6b15c /contrib/csup
parent49d71b658410e80cf74bbb9e9eff44726c3ff914 (diff)
downloadFreeBSD-src-b389e1bc700b4a28122ab88274772ce7759c10ac.zip
FreeBSD-src-b389e1bc700b4a28122ab88274772ce7759c10ac.tar.gz
A few general bugfixes:
- Use internal xmalloc instead of malloc. - Include missing header after warnings. - Fix unneeded printouts. - Fix a bug when checking the CO_NORSYNC flag.
Diffstat (limited to 'contrib/csup')
-rw-r--r--contrib/csup/detailer.c10
-rw-r--r--contrib/csup/rcsfile.c2
-rw-r--r--contrib/csup/rsyncfile.c4
-rw-r--r--contrib/csup/updater.c9
4 files changed, 12 insertions, 13 deletions
diff --git a/contrib/csup/detailer.c b/contrib/csup/detailer.c
index dc16d10..b07a4ae 100644
--- a/contrib/csup/detailer.c
+++ b/contrib/csup/detailer.c
@@ -39,6 +39,7 @@
#include "config.h"
#include "detailer.h"
#include "fixups.h"
+#include "globtree.h"
#include "misc.h"
#include "mux.h"
#include "proto.h"
@@ -398,22 +399,21 @@ detailer_dofile_rsync(struct detailer *d, char *name, char *path)
struct stream *wr;
struct rsyncfile *rf;
+ wr = d->wr;
rf = rsync_open(path, 0, 1);
if (rf == NULL) {
/* Fallback if we fail in opening it. */
proto_printf(wr, "A %s\n", name);
return (0);
}
- wr = d->wr;
proto_printf(wr, "r %s %z %z\n", name, rsync_filesize(rf),
rsync_blocksize(rf));
/* Detail the blocks. */
- while (rsync_nextblock(rf) != 0) {
+ while (rsync_nextblock(rf) != 0)
proto_printf(wr, "%s %s\n", rsync_rsum(rf), rsync_blockmd5(rf));
- lprintf(-1, "%s %s\n", rsync_rsum(rf), rsync_blockmd5(rf));
- }
proto_printf(wr, ".\n");
rsync_close(rf);
+ return (0);
}
/*
@@ -599,7 +599,7 @@ detailer_send_details(struct detailer *d, struct coll *coll, char *name,
} else if (fattr_type(fa) == FT_FILE) {
if (isrcs(name, &len) && !(coll->co_options & CO_NORCS)) {
detailer_dofile_rcs(d, coll, name, path);
- } else if (!(coll->co_options & CO_NORSYNC) ||
+ } else if (!(coll->co_options & CO_NORSYNC) &&
!globtree_test(coll->co_norsync, name)) {
detailer_dofile_rsync(d, name, path);
} else {
diff --git a/contrib/csup/rcsfile.c b/contrib/csup/rcsfile.c
index 37eba83..9a715d6 100644
--- a/contrib/csup/rcsfile.c
+++ b/contrib/csup/rcsfile.c
@@ -708,7 +708,6 @@ rcsfile_print(struct rcsfile *rf)
line = stream_getln(in, NULL);
}
stream_close(in);
- printf("branches: ");
printf("\n");
}
@@ -761,6 +760,7 @@ rcsfile_free(struct rcsfile *rf)
/* Free all deltas in global list */
while (!LIST_EMPTY(&rf->deltatable)) {
d = LIST_FIRST(&rf->deltatable);
+ LIST_REMOVE(d, delta_next);
LIST_REMOVE(d, table_next);
rcsfile_freedelta(d);
}
diff --git a/contrib/csup/rsyncfile.c b/contrib/csup/rsyncfile.c
index a61b1cb..f256ccf 100644
--- a/contrib/csup/rsyncfile.c
+++ b/contrib/csup/rsyncfile.c
@@ -77,9 +77,7 @@ rsync_open(char *path, size_t blocksize, int read)
struct stat st;
int error;
- rf = malloc(sizeof(*rf));
- if (rf == NULL)
- return (NULL);
+ rf = xmalloc(sizeof(*rf));
error = stat(path, &st);
if (error) {
free(rf);
diff --git a/contrib/csup/updater.c b/contrib/csup/updater.c
index 6952695..8ae043e 100644
--- a/contrib/csup/updater.c
+++ b/contrib/csup/updater.c
@@ -615,12 +615,12 @@ updater_docoll(struct updater *up, struct file_update *fup, int isfixups)
error = fup_prepare(fup, name, 0);
if (error)
return (UPDATER_ERR_PROTO);
- sr->sr_type = SR_FILELIVE;
fup->wantmd5 = xstrdup(wantmd5);
fup->temppath = tempname(fup->destpath);
sr = &fup->srbuf;
sr->sr_file = xstrdup(name);
sr->sr_serverattr = fattr_decode(attr);
+ sr->sr_type = SR_FILELIVE;
if (sr->sr_serverattr == NULL)
return (UPDATER_ERR_PROTO);
error = updater_rsync(up, fup, strtol(blocksize, NULL,
@@ -1841,8 +1841,10 @@ updater_addelta(struct rcsfile *rf, struct stream *rd, char *cmdline)
/* First add the delta so we have it. */
d = rcsfile_addelta(rf, revnum, revdate, author, diffbase);
- if (d == NULL)
- err(1, "Error adding delta %s\n", revnum);
+ if (d == NULL) {
+ lprintf(-1, "Error adding delta %s\n", revnum);
+ return (UPDATER_ERR_READ);
+ }
while ((line = stream_getln(rd, NULL)) != NULL) {
if (strcmp(line, ".") == 0)
break;
@@ -2077,7 +2079,6 @@ updater_rsync(struct updater *up, struct file_update *fup, size_t blocksize)
goto bad;
/* Read blocks from original file. */
lseek(orig, SEEK_SET, (blocksize * blockstart));
- blocknum = 0;
error = UPDATER_ERR_MSG;
for (blocknum = 0; blocknum < blockcount; blocknum++) {
nbytes = read(orig, buf, blocksize);
OpenPOWER on IntegriCloud