Bug in compile of rsync 2.5.4 on Tru64 UNIX V5.1a using cc
Paul Haas
paulh at hamjudo.com
Fri Mar 22 08:45:53 EST 2002
On Thu, 21 Mar 2002, Eckert, Robert D wrote:
> Greetings, here is the output of the 'configure' step and
> the compile step (using the Compaq cc compiler that comes
> with Tru64 V5.1A. The configure reported success and most of
> the compile steps cam through error/warning free except for
> the one that stumbled. Can someone help me out here? I am willing
> to provide a binary for Tru64 V5.1A if we can swat this bug.
> We depend greatly on Rsync to keep a fresh backup of our
> 70gb storage system that is the backend of http://www.indiana.edu/,
> Indiana University's main web site to the Internet. We're also big
> fans and soon to be BIG adopters of Samba 2.2.3a.
> Anyway here is the sequence that was encountered:
> cc -I. -I. -g -DHAVE_CONFIG_H -I./popt -c batch.c -o batch.o
> cc: Error: batch.c, line 408: In this statement, a common type could not be
> determined for the 2nd and 3rd operands ("&s->count" and "&int_zero") of a
> conditional operator. (badcondit)
> write_batch_csums_file(s ? &s->count : &int_zero, sizeof(int));
> -------------------------------^
> *** Exit 1
Line 406 says:
/* FIXME: This will break if s->count is ever not exactly an int. */
s->count is a size_t, which is 64 bits on your compiler.
Here's how I would fix it:
===================================================================
RCS file: RCS/batch.c,v
retrieving revision 1.1
diff -u -r1.1 batch.c
--- batch.c 2002/03/21 21:31:52 1.1
+++ batch.c 2002/03/21 21:44:11
@@ -396,16 +396,17 @@
struct sum_struct *s)
{
size_t i;
- unsigned int int_zero = 0;
+ unsigned int int_count;
extern int csum_length;
fdb_open = 1;
/* Write csum info to batch file */
- /* FIXME: This will break if s->count is ever not exactly an int. */
+ /* FIXME: This will break if s->count is ever greater than 2^32 -1 */
write_batch_csums_file(flist_entry, sizeof(int));
- write_batch_csums_file(s ? &s->count : &int_zero, sizeof(int));
+ int_count = s ? (unsigned int) s->count : 0;
+ write_batch_csums_file(&int_count, sizeof(int_count));
if (s) {
for (i = 0; i < s->count; i++) {
More information about the rsync
mailing list