svn commit: r185094 - projects/csup_cvsmode/contrib/csup
Ulf Lilleengen
lulf at FreeBSD.org
Wed Nov 19 06:57:01 PST 2008
Author: lulf
Date: Wed Nov 19 14:57:00 2008
New Revision: 185094
URL: http://svn.freebsd.org/changeset/base/185094
Log:
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.
Modified:
projects/csup_cvsmode/contrib/csup/detailer.c
projects/csup_cvsmode/contrib/csup/rcsfile.c
projects/csup_cvsmode/contrib/csup/rsyncfile.c
projects/csup_cvsmode/contrib/csup/updater.c
Modified: projects/csup_cvsmode/contrib/csup/detailer.c
==============================================================================
--- projects/csup_cvsmode/contrib/csup/detailer.c Wed Nov 19 14:53:20 2008 (r185093)
+++ projects/csup_cvsmode/contrib/csup/detailer.c Wed Nov 19 14:57:00 2008 (r185094)
@@ -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
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
} 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 {
Modified: projects/csup_cvsmode/contrib/csup/rcsfile.c
==============================================================================
--- projects/csup_cvsmode/contrib/csup/rcsfile.c Wed Nov 19 14:53:20 2008 (r185093)
+++ projects/csup_cvsmode/contrib/csup/rcsfile.c Wed Nov 19 14:57:00 2008 (r185094)
@@ -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);
}
Modified: projects/csup_cvsmode/contrib/csup/rsyncfile.c
==============================================================================
--- projects/csup_cvsmode/contrib/csup/rsyncfile.c Wed Nov 19 14:53:20 2008 (r185093)
+++ projects/csup_cvsmode/contrib/csup/rsyncfile.c Wed Nov 19 14:57:00 2008 (r185094)
@@ -77,9 +77,7 @@ rsync_open(char *path, size_t blocksize,
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);
Modified: projects/csup_cvsmode/contrib/csup/updater.c
==============================================================================
--- projects/csup_cvsmode/contrib/csup/updater.c Wed Nov 19 14:53:20 2008 (r185093)
+++ projects/csup_cvsmode/contrib/csup/updater.c Wed Nov 19 14:57:00 2008 (r185094)
@@ -615,12 +615,12 @@ updater_docoll(struct updater *up, struc
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, stru
/* 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
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);
More information about the svn-src-projects
mailing list