[Csync2] Patchwork to running on musl libc and some cleanups

Valery Kartel valery.kartel at gmail.com
Fri Oct 9 12:22:03 CEST 2015


I have a strange runtime error on my Alpinelinux box.
While debugging I found that snprintf("%Ld"...) format for (long long) 
is invalid.
The correct one is "%lld"

The first patch fixes this.

The second patch is a cleanup to not compile a 'strlcmp' function if we 
have system one.

The third patch is to disable ssl by default, because many distros do 
not generate ssl certificate and key.

Don't know where to send patches. So I place it here.

#(1)## printf (long long) format patch ######
--- old/checktxt.c
+++ new/checktxt.c
@@ -49,7 +49,7 @@
         xxprintf("v1");

         if ( !S_ISLNK(st->st_mode) && !S_ISDIR(st->st_mode) )
-               xxprintf(":mtime=%Ld", ign_mtime ? (long long)0 : (long 
long)st->st_mtime);
+               xxprintf(":mtime=%lld", ign_mtime ? (long long)0 : (long 
long)st->st_mtime);

         if ( !csync_ignore_mod )
                 xxprintf(":mode=%d", (int)st->st_mode);
@@ -61,7 +61,7 @@
                 xxprintf(":gid=%d", (int)st->st_gid);

         if ( S_ISREG(st->st_mode) )
-               xxprintf(":type=reg:size=%Ld", (long long)st->st_size);
+               xxprintf(":type=reg:size=%lld", (long long)st->st_size);

         if ( S_ISDIR(st->st_mode) )
                 xxprintf(":type=dir");
--- old/update.c
+++ new/update.c
@@ -469,7 +469,7 @@

  skip_action:
         if ( !S_ISLNK(st.st_mode) ) {
-               conn_printf("SETIME %s %s %Ld\n",
+               conn_printf("SETIME %s %s %lld\n",
                                 url_encode(key), url_encode(filename),
                                 (long long)st.st_mtime);
                 last_conn_status = read_conn_status(filename, peername);

#(2)## have strncpy patch ######
--- old/configure.ac
+++ new/configure.ac
@@ -43,7 +43,7 @@


  dnl inspired by rsync's configure.ac
-AC_CHECK_FUNCS(fchmod setmode open64 mkstemp64)
+AC_CHECK_FUNCS(strlcpy fchmod setmode open64 mkstemp64)
  AC_CACHE_CHECK([for secure mkstemp],csync_cv_HAVE_SECURE_MKSTEMP,[
  AC_TRY_RUN([#include <stdlib.h>
  #include <sys/types.h>
--- old/rsync.c
+++ new/rsync.c
@@ -38,7 +38,7 @@
  #include <w32api/windows.h>
  #endif

-
+#ifndef HAVE_STRLCPY
  /* This has been taken from rsync:lib/compat.c */

  /**
@@ -61,6 +61,7 @@
          }
          return ret;
  }
+#endif

  /* splits filepath at the last '/', if any, like so:
   *     dirname         basename        filepath

#(3)## disable ssl by default #########
--- old/csync2.cfg
+++ new/csync2.cfg
@@ -4,6 +4,10 @@
  # Please read the documentation:
  # http://oss.linbit.com/csync2/paper.pdf

+# Do not use ssl by default.
+# To use ssl, first generate certificate and key, then comment it out.
+nossl * *;
+
  # group mygroup
  # {
  #     host host1 host2 (host3);



More information about the Csync2 mailing list