X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/7e38410e47a05b2b97c58212d08a1d65c8c452b4..82471e68a8bb3da8ca95f2b6564c330c52ce891e:/generator.c diff --git a/generator.c b/generator.c index 4a22581d..8c786e73 100644 --- a/generator.c +++ b/generator.c @@ -117,7 +117,7 @@ static int unchanged_file(char *fn, struct file_struct *file, STRUCT_STAT *st) * * This might be made one of several selectable heuristics. */ -static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len) +static void sum_sizes_sqroot(struct sum_struct *sum, int64 len) { int32 blength; int s2length; @@ -128,7 +128,7 @@ static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len) blength = BLOCK_SIZE; else { int32 c; - uint64 l; + int64 l; int cnt; for (c = 1, l = len, cnt = 0; l >>= 2; c <<= 1, cnt++) {} if (cnt >= 31 || c >= MAX_BLOCK_SIZE) @@ -137,7 +137,7 @@ static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len) blength = 0; do { blength |= c; - if (len < (uint64)blength * blength) + if (len < (int64)blength * blength) blength &= ~c; c >>= 1; } while (c >= 8); /* round to multiple of 8 */ @@ -151,7 +151,7 @@ static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len) s2length = SUM_LENGTH; } else { int32 c; - uint64 l; + int64 l; int b = BLOCKSUM_BIAS; for (l = len; l >>= 1; b += 2) {} for (c = blength; c >>= 1 && b; b--) {} @@ -292,18 +292,15 @@ static void recv_generator(char *fname, struct file_struct *file, int i, * to prepare appropriately. If there is already a * file of that name and it is *not* a directory, then * we need to delete it. If it doesn't exist, then - * recursively create it. */ - - if (dry_run) - return; /* TODO: causes inaccuracies -- fix */ + * (perhaps recursively) create it. */ if (statret == 0 && !S_ISDIR(st.st_mode)) { delete_file(fname, DEL_TERSE); statret = -1; } if (statret != 0 && do_mkdir(fname,file->mode) != 0 && errno != EEXIST) { - if (!(relative_paths && errno == ENOENT - && create_directory_path(fname, orig_umask) == 0 - && do_mkdir(fname, file->mode) == 0)) { + if (!relative_paths || errno != ENOENT + || create_directory_path(fname, orig_umask) < 0 + || do_mkdir(fname, file->mode) < 0) { rsyserr(FERROR, errno, "recv_generator: mkdir %s failed", full_fname(fname));