RSYNC 2.5.2 type mismatches in RECEIVER.C

John Malmberg wb8tyw at
Mon Feb 11 02:47:58 EST 2002

Platform: OpenVMS Alpha 7.3
Compiler: Compaq C T6.5-002 on OpenVMS Alpha V7.3


Best guess at UNIX equivalents of above compile flags:

LEVEL4 = All warnings
QUESTCODE = Do LINT processing on source.

In receiver.c, the code is attempting to put an unsigned 64 bit value 
into a dev_t type and a ino_t type.

This causes the build to break with a type mismatch error.  Casts or 
other code is needed.

On OpenVMS, the st.st_ino member of the stat structure is an unsigned 
short[3] type as it is a 48 bit value, and the Compaq C compilers for 
the VAX architecture can not generate 64 bit integers.  (One of the 
cases mentioned in the comments in RSYNC.H)

My experimental build procedure automatically detects references to 
st.ino and wraps them with a macro to make sure that the correct code is 
generated.  Something like this could be used to deal with this on other 
platforms where the compiler does not support 64 bit integers and pointers.

wb8tyw at
Personal Opinion Only

EAGLE> type receiver.gdiff
--- ref_src:receiver.c  Sat Feb  9 21:17:32 2002
+++ lcl_src:receiver.c  Sat Feb  9 23:32:58 2002
@@ -1,3 +1,24 @@
+/* Converted by prj_src:unix_c_to_vms_c.tpu AND PRJ_SRC:RECEIVER.TPU on 
  9-FEB-2002 23:32:58.66 OPENVMS_AXP */
+#ifndef INO_T_CPY
+#ifdef __VMS
+#define INO_T_CPY(_a, _b) memcpy(_a, _b, 6)
+#define INO_T_CPY(_a, _b) _a = _b
+#ifndef INO_T_CMP
+#ifdef __VMS
+#define INO_T_CMP(_a, _b) memcmp(_a, _b, 6)
+#define INO_T_CMP(_a, _b) _a == _b
  /* -*- c-file-style: "linux" -*-

     Copyright (C) 1996-2000 by Andrew Tridgell
@@ -55,8 +76,8 @@
         if (link_stat(f_name(flist->files[j]), &st)) return 1;

         for (i=0;i<dlist_len;i++) {
-               if (st.st_ino == delete_list[i].inode &&
-                   st.st_dev == delete_list[i].dev)
+               if (INO_T_CMP(st.st_ino, &delete_list[i].inode) &&
+                   st.st_dev == (dev_t)delete_list[i].dev)
                         return 1;

@@ -210,10 +231,10 @@
         unsigned int n,remainder,len,count;
         OFF_T offset = 0;
         OFF_T offset2;
-       char *data;
-       static char file_sum1[MD4_SUM_LENGTH];
-       static char file_sum2[MD4_SUM_LENGTH];
-       char *map=NULL;
+       unsigned char *data;
+       static unsigned char file_sum1[MD4_SUM_LENGTH];
+       static unsigned char file_sum2[MD4_SUM_LENGTH];
+       unsigned char *map=NULL;

         count = read_int(f_in);
         n = read_int(f_in);

More information about the rsync mailing list