replace calls to strcmp() with a u_strcmp() function that uses only
[rsync/rsync.git] / util.c
diff --git a/util.c b/util.c
index 11e4a9d..b80d516 100644 (file)
--- a/util.c
+++ b/util.c
@@ -653,3 +653,17 @@ int pop_dir(char *dir)
 
        return 0;
 }
+
+/* we need to supply our own strcmp function for file list comparisons
+   to ensure that signed/unsigned usage is consistent between machines. */
+int u_strcmp(const char *cs1, const char *cs2)
+{
+       const uchar *s1 = (uchar *)cs1;
+       const uchar *s2 = (uchar *)cs2;
+
+       while (*s1 && *s2 && (*s1 == *s2)) {
+               s1++; s2++;
+       }
+       
+       return (int)*s1 - (int)*s2;
+}