From de565f59bad4cc08c98f36cd582e25d96cab0de5 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sun, 15 Oct 2006 20:22:53 +0000 Subject: [PATCH] Fixed compilation problems that crept into the code. --- atimes.diff | 18 ++++++++++++++++++ early-checksum.diff | 12 ++++++------ link-by-hash.diff | 30 +++++++++++++++--------------- threaded-receiver.diff | 5 +++-- xattrs.diff | 26 ++++++++++++++------------ 5 files changed, 56 insertions(+), 35 deletions(-) diff --git a/atimes.diff b/atimes.diff index 6ded062..43660ba 100644 --- a/atimes.diff +++ b/atimes.diff @@ -282,6 +282,15 @@ After applying this patch, run these commands for a successful build: if (preserve_hard_links && file->link_u.links) { if (dry_run) file->link_u.links->link_dest_used = j + 1; +@@ -930,7 +937,7 @@ static void recv_generator(char *fname, + rsyserr(FERROR, errno, + "recv_generator: mkdir %s failed", + full_fname(fname)); +- file->flags |= FLAG_MISSING; ++ FFLAGS(file) |= FLAG_MISSING; + if (ndx+1 < the_file_list->count + && the_file_list->files[ndx+1]->dir.depth > file->dir.depth) { + rprintf(FERROR, @@ -944,7 +951,7 @@ static void recv_generator(char *fname, && verbose && code != FNONE && f_out != -1) rprintf(code, "%s/\n", fname); @@ -300,6 +309,15 @@ After applying this patch, run these commands for a successful build: } /* open the file */ +@@ -1514,7 +1521,7 @@ void generate_files(int f_out, struct fi + continue; + if (!need_retouch_dir_times && file->mode & S_IWUSR) + continue; +- if (file->flags & FLAG_MISSING) { ++ if (FFLAGS(file) & FLAG_MISSING) { + int missing = file->dir.depth; + while (++i < flist->count) { + file = flist->files[i]; --- old/hlink.c +++ new/hlink.c @@ -30,6 +30,7 @@ extern int make_backups; diff --git a/early-checksum.diff b/early-checksum.diff index 152d08f..25aa0de 100644 --- a/early-checksum.diff +++ b/early-checksum.diff @@ -18,7 +18,7 @@ for a local copy, so the old algorithm is used for local copies. extern int module_id; extern int ignore_errors; extern int numeric_ids; -@@ -693,6 +694,16 @@ static struct file_struct *receive_file_ +@@ -697,6 +698,16 @@ static struct file_struct *receive_file_ sum = empty_sum; } read_buf(f, sum, checksum_len); @@ -73,7 +73,7 @@ for a local copy, so the old algorithm is used for local copies. continue; best_match = j; match_level = 2; -@@ -1210,7 +1214,7 @@ static void recv_generator(char *fname, +@@ -1212,7 +1216,7 @@ static void recv_generator(char *fname, ; else if (fnamecmp_type == FNAMECMP_FUZZY) ; @@ -84,8 +84,8 @@ for a local copy, so the old algorithm is used for local copies. handle_partial_dir(partialptr, PDIR_DELETE); --- old/hlink.c +++ new/hlink.c -@@ -220,7 +220,7 @@ int hard_link_check(struct file_struct * - itemizing = code = 0; +@@ -222,7 +222,7 @@ int hard_link_check(struct file_struct * + } break; } - if (!unchanged_file(cmpbuf, file, &st3)) @@ -127,7 +127,7 @@ for a local copy, so the old algorithm is used for local copies. + strlcpy(olddir, curr_dir, sizeof olddir); + if (always_checksum && !local_server && argc > 0) -+ pre_checksum = push_dir(argv[0]); ++ pre_checksum = push_dir(argv[0], 0); + flist = recv_file_list(f_in); verbose = save_verbose; @@ -156,7 +156,7 @@ for a local copy, so the old algorithm is used for local copies. + strlcpy(olddir, curr_dir, sizeof olddir); + if (always_checksum && !local_server) -+ pre_checksum = push_dir(argv[0]); ++ pre_checksum = push_dir(argv[0], 0); + if (write_batch && !am_server) start_write_batch(f_in); diff --git a/link-by-hash.diff b/link-by-hash.diff index 03a0304..8cd07a4 100644 --- a/link-by-hash.diff +++ b/link-by-hash.diff @@ -14,7 +14,7 @@ the file's name. --- old/Makefile.in +++ new/Makefile.in -@@ -34,7 +34,7 @@ OBJS1=rsync.o generator.o receiver.o cle +@@ -35,7 +35,7 @@ OBJS1=rsync.o generator.o receiver.o cle main.o checksum.o match.o syscall.o log.o backup.o OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o \ fileio.o batch.o clientname.o chmod.o @@ -392,7 +392,7 @@ the file's name. OPT_SERVER, OPT_REFUSED_BASE = 9000}; static struct poptOption long_options[] = { -@@ -494,6 +496,7 @@ static struct poptOption long_options[] +@@ -495,6 +497,7 @@ static struct poptOption long_options[] {"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 }, {"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 }, {"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 }, @@ -400,7 +400,7 @@ the file's name. {"fuzzy", 'y', POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 }, {"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 }, {"compress-level", 0, POPT_ARG_INT, &def_compress_level, 'z', 0, 0 }, -@@ -1083,6 +1086,21 @@ int parse_arguments(int *argc, const cha +@@ -1085,6 +1088,21 @@ int parse_arguments(int *argc, const cha usage(FINFO); exit_cleanup(0); @@ -408,7 +408,7 @@ the file's name. +#if HAVE_LINK + arg = poptGetOptArg(pc); + if (sanitize_paths) -+ arg = sanitize_path(NULL, arg, NULL, 0); ++ arg = sanitize_path(NULL, arg, NULL, 0, NULL); + link_by_hash_dir = (char *)arg; + break; +#else @@ -422,7 +422,7 @@ the file's name. default: /* A large opt value means that set_refuse_options() * turned this option off. */ -@@ -1737,6 +1755,11 @@ void server_options(char **args,int *arg +@@ -1735,6 +1753,11 @@ void server_options(char **args,int *arg } } @@ -444,7 +444,7 @@ the file's name. extern char *partial_dir; extern char *basis_dir[]; extern struct file_list *the_file_list; -@@ -121,12 +122,13 @@ static int get_tmpname(char *fnametmp, c +@@ -124,12 +125,13 @@ static int get_tmpname(char *fnametmp, c static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, @@ -459,7 +459,7 @@ the file's name. int32 len; OFF_T offset = 0; OFF_T offset2; -@@ -146,6 +148,9 @@ static int receive_data(int f_in, char * +@@ -149,6 +151,9 @@ static int receive_data(int f_in, char * } else mapbuf = NULL; @@ -469,7 +469,7 @@ the file's name. sum_init(checksum_seed); if (append_mode) { -@@ -188,6 +193,8 @@ static int receive_data(int f_in, char * +@@ -191,6 +196,8 @@ static int receive_data(int f_in, char * cleanup_got_literal = 1; sum_update(data, i); @@ -478,7 +478,7 @@ the file's name. if (fd != -1 && write_file(fd,data,i) != i) goto report_write_error; -@@ -214,6 +221,8 @@ static int receive_data(int f_in, char * +@@ -217,6 +224,8 @@ static int receive_data(int f_in, char * see_token(map, len); sum_update(map, len); @@ -486,8 +486,8 @@ the file's name. + mdfour_update(&mdfour_data, (uchar*)map, len); } - if (inplace) { -@@ -256,6 +265,8 @@ static int receive_data(int f_in, char * + if (updating_basis) { +@@ -259,6 +268,8 @@ static int receive_data(int f_in, char * } sum_end(file_sum1); @@ -496,7 +496,7 @@ the file's name. if (mapbuf) unmap_file(mapbuf); -@@ -271,7 +282,7 @@ static int receive_data(int f_in, char * +@@ -274,7 +285,7 @@ static int receive_data(int f_in, char * static void discard_receive_data(int f_in, OFF_T length) { @@ -505,7 +505,7 @@ the file's name. } static void handle_delayed_updates(struct file_list *flist, char *local_name) -@@ -601,8 +612,12 @@ int recv_files(int f_in, struct file_lis +@@ -611,8 +622,12 @@ int recv_files(int f_in, struct file_lis rprintf(FINFO, "%s\n", fname); /* recv file data */ @@ -529,7 +529,7 @@ the file's name. extern struct stats stats; extern struct chmod_mode_struct *daemon_chmod_modes; -@@ -266,8 +267,15 @@ void finish_transfer(char *fname, char * +@@ -271,8 +272,15 @@ void finish_transfer(char *fname, char * /* move tmp file over real file */ if (verbose > 2) rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname); @@ -549,7 +549,7 @@ the file's name. ret == -2 ? "copy" : "rename", --- old/rsync.h +++ new/rsync.h -@@ -644,6 +644,14 @@ struct stats { +@@ -651,6 +651,14 @@ struct stats { int current_file_index; }; diff --git a/threaded-receiver.diff b/threaded-receiver.diff index 18c3e2c..a3efda2 100644 --- a/threaded-receiver.diff +++ b/threaded-receiver.diff @@ -58,7 +58,7 @@ After applying this patch, run these commands for a successful build: if (exit_code) /* Preserve first error code when recursing. */ code = exit_code; -@@ -162,8 +155,6 @@ NORETURN void _exit_cleanup(int code, co +@@ -157,8 +150,6 @@ NORETURN void _exit_cleanup(int code, co if (cleanup_fname) do_unlink(cleanup_fname); @@ -719,7 +719,8 @@ After applying this patch, run these commands for a successful build: } } - void io_flush(int flush_it_all) +-void io_flush(int flush_it_all) ++void io_flush(UNUSED(int flush_it_all)) { - msg2genr_flush(flush_it_all); - msg2sndr_flush(); diff --git a/xattrs.diff b/xattrs.diff index 835bc41..16361d2 100644 --- a/xattrs.diff +++ b/xattrs.diff @@ -175,7 +175,7 @@ TODO: extern int preserve_links; extern int preserve_hard_links; extern int preserve_devices; -@@ -494,7 +495,7 @@ static struct file_struct *receive_file_ +@@ -498,7 +499,7 @@ static struct file_struct *receive_file_ char thisname[MAXPATHLEN]; unsigned int l1 = 0, l2 = 0; int alloc_len, basename_len, dirname_len, linkname_len, sum_len; @@ -184,7 +184,7 @@ TODO: int xtra_len; #endif OFF_T file_length; -@@ -606,10 +607,16 @@ static struct file_struct *receive_file_ +@@ -610,10 +611,16 @@ static struct file_struct *receive_file_ xtra_len = (S_ISDIR(mode) ? 2 : 1) * 4; else xtra_len = 0; @@ -202,7 +202,7 @@ TODO: + xtra_len #endif + linkname_len + sum_len; -@@ -618,7 +625,7 @@ static struct file_struct *receive_file_ +@@ -622,7 +629,7 @@ static struct file_struct *receive_file_ file = (struct file_struct *)bp; memset(bp, 0, file_struct_len); bp += file_struct_len; @@ -211,7 +211,7 @@ TODO: bp += xtra_len; #endif -@@ -719,6 +726,10 @@ static struct file_struct *receive_file_ +@@ -723,6 +730,10 @@ static struct file_struct *receive_file_ if (preserve_acls) receive_acl(file, f); #endif @@ -222,7 +222,7 @@ TODO: return file; } -@@ -989,6 +1000,13 @@ static struct file_struct *send_file_nam +@@ -994,6 +1005,13 @@ static struct file_struct *send_file_nam return NULL; } #endif @@ -236,7 +236,7 @@ TODO: maybe_emit_filelist_progress(flist->count + flist_count_offset); -@@ -1001,11 +1019,19 @@ static struct file_struct *send_file_nam +@@ -1006,11 +1024,19 @@ static struct file_struct *send_file_nam if (preserve_acls) send_acl(&sx, f); #endif @@ -389,7 +389,7 @@ TODO: {"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 }, {"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, {"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 }, -@@ -1113,6 +1123,17 @@ int parse_arguments(int *argc, const cha +@@ -1114,6 +1124,17 @@ int parse_arguments(int *argc, const cha return 0; #endif @@ -407,7 +407,7 @@ TODO: default: /* A large opt value means that set_refuse_options() -@@ -1563,6 +1584,10 @@ void server_options(char **args,int *arg +@@ -1560,6 +1581,10 @@ void server_options(char **args,int *arg if (preserve_acls) argstr[x++] = 'A'; #endif @@ -452,7 +452,7 @@ TODO: #define GID_NONE ((gid_t)-1) #define HL_CHECK_MASTER 0 -@@ -693,6 +697,9 @@ typedef struct { +@@ -695,6 +699,9 @@ typedef struct { struct rsync_acl *acc_acl; /* access ACL */ struct rsync_acl *def_acl; /* default ACL */ #endif @@ -481,7 +481,7 @@ TODO: -o, --owner preserve owner (super-user only) -g, --group preserve group --devices preserve device files (super-user only) -@@ -812,6 +813,11 @@ version makes it incompatible with sendi +@@ -810,6 +811,11 @@ version makes it incompatible with sendi rsync unless you double the bf(--acls) option (e.g. bf(-AA)). This doubling is not needed when pulling files from an older rsync. @@ -495,7 +495,7 @@ TODO: transfer. The resulting value is treated as though it was the permissions --- old/xattr.c +++ new/xattr.c -@@ -0,0 +1,358 @@ +@@ -0,0 +1,360 @@ +/* + * Extended Attribute support for rsync. + * Written by Jay Fenlason, vaguely based on the ACLs patch. @@ -724,7 +724,9 @@ TODO: +static void rsync_xal_store(item_list *xalp) +{ + item_list *new_lst = EXPAND_ITEM_LIST(&rsync_xal_l, item_list, RSYNC_XAL_LIST_INITIAL); -+ EXPAND_ITEM_LIST(new_lst, item_list, xalp->count); ++ /* Since the following call starts a new list, we know it will hold the ++ * entire initial-count, not just enough space for one new item. */ ++ (void)EXPAND_ITEM_LIST(new_lst, item_list, xalp->count); + memcpy(new_lst->items, xalp->items, xalp->count * sizeof (item_list)); + new_lst->count = xalp->count; + xalp->count = 0; -- 2.34.1