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

2015-10-12 Thread Lars Ellenberg
On Fri, Oct 09, 2015 at 01:22:03PM +0300, Valery Kartel wrote:
> 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.

Best place to send patches for csync2.
Thanks, looks innocent enough ;-)

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

Cheers,

-- 
: Lars Ellenberg
: http://www.LINBIT.com | Your Way to High Availability
: DRBD, Linux-HA  and  Pacemaker support and consulting

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
___
Csync2 mailing list
Csync2@lists.linbit.com
http://lists.linbit.com/mailman/listinfo/csync2


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

2015-10-09 Thread Valery Kartel

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 
 #include 
--- old/rsync.c
+++ new/rsync.c
@@ -38,7 +38,7 @@
 #include 
 #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 basenamefilepath

#(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);

___
Csync2 mailing list
Csync2@lists.linbit.com
http://lists.linbit.com/mailman/listinfo/csync2