[Csync2] sqlite3 and _FILE_OFFSET_BITS=64
Art -kwaak- van Breemen
ard+csync2 at telegraafnet.nl
Thu Jun 12 16:20:31 CEST 2008
Helo,
I've noticed that there was no (working) sqlite3 support.
So I've continued working on the patch I found on:
http://tmp.askask.com/2008/01/csync2-sqlite3-wip.patch
The biggest change with sqlite3 is that you have to access the
columns with functions.
Fortunately every field type used in csync2 is text, so I used
the blob type from sqlite3.
This has impact on the usage of SQL_V[], so I changed that into
SQL_V().
I haven't tested this patch more than "csync2 -c -r /something",
which delivers a working file database, and doing some "csync2 -h
-r /something/else;csync2 -c".
I need to set up a testing environment to continue.
Using sqlite3 a few things can be changed, and probably
optimized.
Second thing I noticed when I was doing my "csync2 -c -r
/something" is that lstat whined about the size of my
off_t. Unlike spam, I managed to double it's size by just
defining _FILE_OFFSET_BITS=64 in csync2.h .
The patch is against the debian package (sid 1.34-1).
And again: I haven't tested it more than the -c and -h against a
single host. It fixes having files >= 4G, which would be insane,
but you don't want it to break on that.
the patch:
(also available from:
http://217.196.41.9/~ard/csync2-1.34-deb-sqlite3-preliminary.diff
)
diff -ruN csync2-1.34.vanilla/action.c csync2-1.34/action.c
--- csync2-1.34.vanilla/action.c 2007-07-24 23:04:18.000000000 +0200
+++ csync2-1.34/action.c 2008-06-12 15:36:47.000000000 +0200
@@ -69,7 +69,7 @@
"SELECT filename from action WHERE command = '%s' "
"and logfile = '%s'", command, logfile)
{
- textlist_add(&tl, SQL_V[0], 0);
+ textlist_add(&tl, SQL_V(0), 0);
} SQL_END;
mark = strstr(command_clr, "%%");
@@ -130,7 +130,7 @@
SQL_BEGIN("Checking for sceduled commands",
"SELECT command, logfile FROM action GROUP BY command, logfile")
{
- textlist_add2(&tl, SQL_V[0], SQL_V[1], 0);
+ textlist_add2(&tl, SQL_V(0), SQL_V(1), 0);
} SQL_END;
for (t = tl; t != 0; t = t->next)
diff -ruN csync2-1.34.vanilla/check.c csync2-1.34/check.c
--- csync2-1.34.vanilla/check.c 2007-07-24 23:04:18.000000000 +0200
+++ csync2-1.34/check.c 2008-06-12 15:36:47.000000000 +0200
@@ -159,7 +159,7 @@
"SELECT filename from file where "
"filename = '%s' %s ORDER BY filename", url_encode(file), where_rec)
{
- const char *filename = url_decode(SQL_V[0]);
+ const char *filename = url_decode(SQL_V(0));
if ( lstat_strict(prefixsubst(filename), &st) != 0 || csync_check_pure(filename) )
textlist_add(&tl, filename, 0);
} SQL_END;
@@ -213,8 +213,9 @@
if ( check_type>0 && lstat_strict(prefixsubst(file), &st) != 0 ) {
if ( ignnoent ) return 0;
+ perror("blup");
csync_fatal("This should not happen: "
- "Can't stat %s.\n", file);
+ "Can't stat %s %s %d %d %d.\n", prefixsubst(file), file,stat(file,&st),lstat_strict(file,&st),errno);
}
switch ( check_type )
@@ -231,7 +232,7 @@
"filename = '%s'", url_encode(file))
{
if ( !csync_cmpchecktxt(checktxt,
- url_decode(SQL_V[0])) ) {
+ url_decode(SQL_V(0))) ) {
csync_debug(2, "File has changed: %s\n", file);
this_is_dirty = 1;
}
diff -ruN csync2-1.34.vanilla/config.h.in csync2-1.34/config.h.in
--- csync2-1.34.vanilla/config.h.in 2007-07-24 23:04:24.000000000 +0200
+++ csync2-1.34/config.h.in 2008-06-12 15:36:47.000000000 +0200
@@ -6,8 +6,8 @@
/* Define to 1 if you have the `rsync' library (-lrsync). */
#undef HAVE_LIBRSYNC
-/* Define to 1 if you have the `sqlite' library (-lsqlite). */
-#undef HAVE_LIBSQLITE
+/* Define to 1 if you have the `sqlite3' library (-lsqlite3). */
+#undef HAVE_LIBSQLITE3
/* Name of package */
#undef PACKAGE
diff -ruN csync2-1.34.vanilla/configure csync2-1.34/configure
--- csync2-1.34.vanilla/configure 2007-07-24 23:04:25.000000000 +0200
+++ csync2-1.34/configure 2008-06-12 15:36:47.000000000 +0200
@@ -3671,13 +3671,13 @@
else
-{ echo "$as_me:$LINENO: checking for sqlite_exec in -lsqlite" >&5
-echo $ECHO_N "checking for sqlite_exec in -lsqlite... $ECHO_C" >&6; }
-if test "${ac_cv_lib_sqlite_sqlite_exec+set}" = set; then
+{ echo "$as_me:$LINENO: checking for sqlite3_exec in -lsqlite3" >&5
+echo $ECHO_N "checking for sqlite3_exec in -lsqlite3... $ECHO_C" >&6; }
+if test "${ac_cv_lib_sqlite3_sqlite3_exec+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsqlite $LIBS"
+LIBS="-lsqlite3 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -3691,11 +3691,11 @@
#ifdef __cplusplus
extern "C"
#endif
-char sqlite_exec ();
+char sqlite3_exec ();
int
main ()
{
-return sqlite_exec ();
+return sqlite3_exec ();
;
return 0;
}
@@ -3718,30 +3718,30 @@
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
- ac_cv_lib_sqlite_sqlite_exec=yes
+ ac_cv_lib_sqlite3_sqlite3_exec=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_sqlite_sqlite_exec=no
+ ac_cv_lib_sqlite3_sqlite3_exec=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite_sqlite_exec" >&5
-echo "${ECHO_T}$ac_cv_lib_sqlite_sqlite_exec" >&6; }
-if test $ac_cv_lib_sqlite_sqlite_exec = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite3_sqlite3_exec" >&5
+echo "${ECHO_T}$ac_cv_lib_sqlite3_sqlite3_exec" >&6; }
+if test $ac_cv_lib_sqlite3_sqlite3_exec = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBSQLITE 1
+#define HAVE_LIBSQLITE3 1
_ACEOF
- LIBS="-lsqlite $LIBS"
+ LIBS="-lsqlite3 $LIBS"
else
- { { echo "$as_me:$LINENO: error: libsqlite is required" >&5
-echo "$as_me: error: libsqlite is required" >&2;}
+ { { echo "$as_me:$LINENO: error: libsqlite3 is required" >&5
+echo "$as_me: error: libsqlite3 is required" >&2;}
{ (exit 1); exit 1; }; }
fi
diff -ruN csync2-1.34.vanilla/configure.ac csync2-1.34/configure.ac
--- csync2-1.34.vanilla/configure.ac 2007-07-24 23:04:19.000000000 +0200
+++ csync2-1.34/configure.ac 2008-06-12 15:36:47.000000000 +0200
@@ -47,7 +47,7 @@
AS_HELP_STRING([--with-libsqlite-source=source-tar-file],
[build this libsqlite and link statically against it (hack! hack!)]),
AC_SUBST([libsqlite_source_file], $withval),
- AC_CHECK_LIB([sqlite], [sqlite_exec], , [AC_MSG_ERROR(libsqlite is required)])
+ AC_CHECK_LIB([sqlite3], [sqlite3_exec], , [AC_MSG_ERROR(libsqlite3 is required)])
)
AM_CONDITIONAL([PRIVATE_LIBSQLITE], [test -n "$libsqlite_source_file"])
diff -ruN csync2-1.34.vanilla/conn.c csync2-1.34/conn.c
--- csync2-1.34.vanilla/conn.c 2007-07-24 23:04:18.000000000 +0200
+++ csync2-1.34/conn.c 2008-06-12 15:36:47.000000000 +0200
@@ -181,7 +181,7 @@
"SELECT certdata FROM x509_cert WHERE peername = '%s'",
url_encode(peername))
{
- if (!strcmp(SQL_V[0], certdata))
+ if (!strcmp(SQL_V(0), certdata))
cert_is_ok = 1;
else
cert_is_ok = 0;
diff -ruN csync2-1.34.vanilla/csync2.c csync2-1.34/csync2.c
--- csync2-1.34.vanilla/csync2.c 2007-07-24 23:04:18.000000000 +0200
+++ csync2-1.34/csync2.c 2008-06-12 15:36:47.000000000 +0200
@@ -582,8 +582,8 @@
SQL_BEGIN("Check all hints",
"SELECT filename, recursive FROM hint")
{
- textlist_add(&tl, url_decode(SQL_V[0]),
- atoi(SQL_V[1]));
+ textlist_add(&tl, url_decode(SQL_V(0)),
+ atoi(SQL_V(1)));
} SQL_END;
for (t = tl; t != 0; t = t->next) {
@@ -659,7 +659,7 @@
"SELECT filename FROM file WHERE filename = '%s' %s",
url_encode(realname), where_rec)
{
- char *filename = strdup(url_encode(SQL_V[0]));
+ char *filename = strdup(url_encode(SQL_V(0)));
csync_mark(filename, 0, 0);
free(filename);
} SQL_END;
@@ -695,7 +695,7 @@
SQL_BEGIN("DB Dump - Hint",
"SELECT recursive, filename FROM hint ORDER BY filename")
{
- printf("%s\t%s\n", SQL_V[0], url_decode(SQL_V[1]));
+ printf("%s\t%s\n", SQL_V(0), url_decode(SQL_V(1)));
retval = -1;
} SQL_END;
break;
@@ -705,8 +705,8 @@
SQL_BEGIN("DB Dump - File",
"SELECT checktxt, filename FROM file ORDER BY filename")
{
- if (csync_find_next(0, url_decode(SQL_V[1]))) {
- printf("%s\t%s\n", url_decode(SQL_V[0]), url_decode(SQL_V[1]));
+ if (csync_find_next(0, url_decode(SQL_V(1)))) {
+ printf("%s\t%s\n", url_decode(SQL_V(0)), url_decode(SQL_V(1)));
retval = -1;
}
} SQL_END;
@@ -717,8 +717,8 @@
SQL_BEGIN("DB Dump - File",
"SELECT checktxt, filename FROM file ORDER BY filename")
{
- if ( csync_match_file_host(url_decode(SQL_V[1]), argv[optind], argv[optind+1], 0) ) {
- printf("%s\t%s\n", url_decode(SQL_V[0]), url_decode(SQL_V[1]));
+ if ( csync_match_file_host(url_decode(SQL_V(1)), argv[optind], argv[optind+1], 0) ) {
+ printf("%s\t%s\n", url_decode(SQL_V(0)), url_decode(SQL_V(1)));
retval = -1;
}
} SQL_END;
@@ -769,9 +769,9 @@
SQL_BEGIN("DB Dump - Dirty",
"SELECT force, myname, peername, filename FROM dirty ORDER BY filename")
{
- if (csync_find_next(0, url_decode(SQL_V[3]))) {
- printf("%s\t%s\t%s\t%s\n", atoi(SQL_V[0]) ? "force" : "chary",
- url_decode(SQL_V[1]), url_decode(SQL_V[2]), url_decode(SQL_V[3]));
+ if (csync_find_next(0, url_decode(SQL_V(3)))) {
+ printf("%s\t%s\t%s\t%s\n", atoi(SQL_V(0)) ? "force" : "chary",
+ url_decode(SQL_V(1)), url_decode(SQL_V(2)), url_decode(SQL_V(3)));
retval = -1;
}
} SQL_END;
diff -ruN csync2-1.34.vanilla/csync2.h csync2-1.34/csync2.h
--- csync2-1.34.vanilla/csync2.h 2007-07-24 23:04:18.000000000 +0200
+++ csync2-1.34/csync2.h 2008-06-12 15:36:47.000000000 +0200
@@ -22,6 +22,7 @@
#define CSYNC2_H 1
#define _GNU_SOURCE
+#define _FILE_OFFSET_BITS 64
#include "config.h"
#include <stdio.h>
@@ -91,19 +92,24 @@
extern int csync_db_next(void *vmx, const char *err,
int *pN, const char ***pazValue, const char ***pazColName);
extern void csync_db_fin(void *vmx, const char *err);
+extern void * csync_db_colblob(void *stmtx,int col);
+
#define SQL(e, s, ...) csync_db_sql(e, s, ##__VA_ARGS__)
+#define SQL_V(col) \
+ (csync_db_colblob(SQL_VM,col))
+
#define SQL_BEGIN(e, s, ...) \
{ \
char *SQL_ERR = e; \
void *SQL_VM = csync_db_begin(SQL_ERR, s, ##__VA_ARGS__); \
int SQL_COUNT = 0; \
while (1) { \
- const char **SQL_V, **SQL_N; \
+ const char **notSQL_V, **notSQL_N; \
int SQL_C; \
if ( !csync_db_next(SQL_VM, SQL_ERR, \
- &SQL_C, &SQL_V, &SQL_N) ) break; \
+ &SQL_C, ¬SQL_V, ¬SQL_N) ) break; \
SQL_COUNT++;
#define SQL_FIN }{
diff -ruN csync2-1.34.vanilla/daemon.c csync2-1.34/daemon.c
--- csync2-1.34.vanilla/daemon.c 2007-07-24 23:04:18.000000000 +0200
+++ csync2-1.34/daemon.c 2008-06-12 15:36:47.000000000 +0200
@@ -443,8 +443,8 @@
strcmp(tag[2], "-") ? url_encode(tag[2]) : "",
strcmp(tag[2], "-") ? "'" : "")
{
- if ( csync_match_file_host(url_decode(SQL_V[1]), tag[1], peer, (const char **)&tag[3]) )
- conn_printf("%s\t%s\n", SQL_V[0], SQL_V[1]);
+ if ( csync_match_file_host(url_decode(SQL_V(1)), tag[1], peer, (const char **)&tag[3]) )
+ conn_printf("%s\t%s\n", SQL_V(0), SQL_V(1));
} SQL_END;
break;
diff -ruN csync2-1.34.vanilla/db.c csync2-1.34/db.c
--- csync2-1.34.vanilla/db.c 2007-07-24 23:04:18.000000000 +0200
+++ csync2-1.34/db.c 2008-06-12 15:36:47.000000000 +0200
@@ -19,7 +19,7 @@
*/
#include "csync2.h"
-#include <sqlite.h>
+#include <sqlite3.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -33,7 +33,7 @@
int db_blocking_mode = 1;
int db_sync_mode = 1;
-static sqlite *db = 0;
+static sqlite3 *db = 0;
static int get_dblock_timeout()
{
@@ -128,44 +128,46 @@
void csync_db_open(const char *file)
{
- db = sqlite_open(file, 0, 0);
- if ( db == 0 )
- csync_fatal("Can't open database: %s\n", file);
+ int r;
+ //db = sqlite_open(file, 0, 0);
+ r=sqlite3_open(file, &db);
+ if ( db == 0 || r)
+ csync_fatal("Can't open database: %s, result %d\n", file,r);
/* ignore errors on table creation */
in_sql_query++;
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE file ("
" filename, checktxt,"
" UNIQUE ( filename ) ON CONFLICT REPLACE"
")",
0, 0, 0);
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE dirty ("
" filename, force, myname, peername,"
" UNIQUE ( filename, peername ) ON CONFLICT IGNORE"
")",
0, 0, 0);
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE hint ("
" filename, recursive,"
" UNIQUE ( filename, recursive ) ON CONFLICT IGNORE"
")",
0, 0, 0);
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE action ("
" filename, command, logfile,"
" UNIQUE ( filename, command ) ON CONFLICT IGNORE"
")",
0, 0, 0);
- sqlite_exec(db,
+ sqlite3_exec(db,
"CREATE TABLE x509_cert ("
" peername, certdata,"
" UNIQUE ( peername ) ON CONFLICT IGNORE"
")",
0, 0, 0);
if (!db_sync_mode)
- sqlite_exec(db, "PRAGMA synchronous = OFF", 0, 0, 0);
+ sqlite3_exec(db, "PRAGMA synchronous = OFF", 0, 0, 0);
in_sql_query--;
}
@@ -178,7 +180,7 @@
SQL("COMMIT TRANSACTION", "COMMIT TRANSACTION");
tqueries_counter = -10;
}
- sqlite_close(db);
+ sqlite3_close(db);
begin_commit_recursion--;
db = 0;
}
@@ -199,7 +201,7 @@
csync_debug(2, "SQL: %s\n", sql);
while (1) {
- rc = sqlite_exec(db, sql, 0, 0, 0);
+ rc = sqlite3_exec(db, sql, 0, 0, 0);
if ( rc != SQLITE_BUSY ) break;
if (busyc++ > get_dblock_timeout()) { db = 0; csync_fatal(DEADLOCK_MESSAGE); }
csync_debug(2, "Database is busy, sleeping a sec.\n");
@@ -216,7 +218,8 @@
void* csync_db_begin(const char *err, const char *fmt, ...)
{
- sqlite_vm *vm;
+ //sqlite_vm *vm;
+ sqlite3_stmt *stmt;
char *sql;
va_list ap;
int rc, busyc = 0;
@@ -231,7 +234,7 @@
csync_debug(2, "SQL: %s\n", sql);
while (1) {
- rc = sqlite_compile(db, sql, 0, &vm, 0);
+ rc = sqlite3_prepare(db, sql, 0, &stmt, 0);
if ( rc != SQLITE_BUSY ) break;
if (busyc++ > get_dblock_timeout()) { db = 0; csync_fatal(DEADLOCK_MESSAGE); }
csync_debug(2, "Database is busy, sleeping a sec.\n");
@@ -242,19 +245,21 @@
csync_fatal("Database Error: %s [%d]: %s\n", err, rc, sql);
free(sql);
- return vm;
+ return stmt;
}
-int csync_db_next(void *vmx, const char *err,
+int csync_db_next(void *stmtx, const char *err,
int *pN, const char ***pazValue, const char ***pazColName)
{
- sqlite_vm *vm = vmx;
+ //sqlite_vm *vm = vmx;
+ sqlite3_stmt *stmt = stmtx;
int rc, busyc = 0;
csync_debug(4, "Trying to fetch a row from the database.\n");
while (1) {
- rc = sqlite_step(vm, pN, pazValue, pazColName);
+ //rc = sqlite_step(vm, pN, pazValue, pazColName);
+ rc = sqlite3_step(stmt);
if ( rc != SQLITE_BUSY ) break;
if (busyc++ > get_dblock_timeout()) { db = 0; csync_fatal(DEADLOCK_MESSAGE); }
csync_debug(2, "Database is busy, sleeping a sec.\n");
@@ -267,16 +272,21 @@
return rc == SQLITE_ROW;
}
+void * csync_db_colblob(void *stmtx,int col) {
+ sqlite3_stmt *stmt = stmtx;
+ return sqlite3_column_blob(stmt,col);
+}
-void csync_db_fin(void *vmx, const char *err)
+void csync_db_fin(void *stmtx, const char *err)
{
- sqlite_vm *vm = vmx;
+ //sqlite_vm *vm = vmx;
+ sqlite3_stmt *stmt=stmtx;
int rc, busyc = 0;
csync_debug(2, "SQL Query finished.\n");
while (1) {
- rc = sqlite_finalize(vm, 0);
+ rc = sqlite3_finalize(stmt);
if ( rc != SQLITE_BUSY ) break;
if (busyc++ > get_dblock_timeout()) { db = 0; csync_fatal(DEADLOCK_MESSAGE); }
csync_debug(2, "Database is busy, sleeping a sec.\n");
diff -ruN csync2-1.34.vanilla/debian/changelog csync2-1.34/debian/changelog
--- csync2-1.34.vanilla/debian/changelog 2008-06-12 15:35:59.000000000 +0200
+++ csync2-1.34/debian/changelog 2008-06-12 15:36:47.000000000 +0200
@@ -1,3 +1,9 @@
+csync2 (1.34-2) unstable; urgency=low
+
+ * sqlite3
+
+ -- Ard van Breemen <ard at telegraafnet.nl> Wed, 11 Jun 2008 15:07:53 +0200
+
csync2 (1.34-1) unstable; urgency=low
* New upstream release
diff -ruN csync2-1.34.vanilla/debian/control csync2-1.34/debian/control
--- csync2-1.34.vanilla/debian/control 2008-06-12 15:35:59.000000000 +0200
+++ csync2-1.34/debian/control 2008-06-12 15:36:47.000000000 +0200
@@ -2,13 +2,13 @@
Section: admin
Priority: optional
Maintainer: Cyril Bouthors <cyril at bouthors.org>
-Build-Depends: debhelper (>= 4.0.0), librsync-dev, libsqlite0-dev, libgnutls-dev, bison, flex
+Build-Depends: debhelper (>= 4.0.0), librsync-dev, libsqlite3-dev, libgnutls-dev, bison, flex
Standards-Version: 3.7.2
Package: csync2
Architecture: any
Depends: ${shlibs:Depends}, netbase (>=4.25)
-Suggests: sqlite
+Suggests: sqlite3
Description: cluster synchronization tool
CSYNC2 synchronizes files in a cluster using the rsync-algorithm.
It maintains a database of modified files so it is able to handle
diff -ruN csync2-1.34.vanilla/debian/rules csync2-1.34/debian/rules
--- csync2-1.34.vanilla/debian/rules 2008-06-12 15:35:59.000000000 +0200
+++ csync2-1.34/debian/rules 2008-06-12 15:36:47.000000000 +0200
@@ -7,16 +7,18 @@
export DH_VERBOSE=1
-CFLAGS = -Wall -g
+#DEB_BUILD_OPTIONS=nostrip
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+CFLAGS = -Wall -g -D_FILE_OFFSET_BITS=64
+
+#ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
- INSTALL_PROGRAM += -s
-endif
+#else
+# CFLAGS += -O2
+#endif
+#ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+# INSTALL_PROGRAM += -s
+#endif
configure: configure-stamp
configure-stamp:
@@ -61,7 +63,7 @@
dh_installman csync2.1
dh_installcron
dh_link
- dh_strip
+# dh_strip
dh_compress
dh_fixperms
dh_installdeb
diff -ruN csync2-1.34.vanilla/Makefile.in csync2-1.34/Makefile.in
--- csync2-1.34.vanilla/Makefile.in 2007-07-24 23:04:25.000000000 +0200
+++ csync2-1.34/Makefile.in 2008-06-12 15:36:47.000000000 +0200
@@ -215,7 +215,7 @@
DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL Makefile.am NEWS TODO aclocal.m4 \
cfgfile_parser.c cfgfile_parser.h cfgfile_scanner.c config.h.in \
- configure.ac depcomp install-sh missing mkinstalldirs
+ configure configure.ac depcomp install-sh missing mkinstalldirs
SOURCES = $(csync2_SOURCES)
all: $(BUILT_SOURCES) config.h
diff -ruN csync2-1.34.vanilla/update.c csync2-1.34/update.c
--- csync2-1.34.vanilla/update.c 2007-07-24 23:04:18.000000000 +0200
+++ csync2-1.34/update.c 2008-06-12 15:36:47.000000000 +0200
@@ -545,12 +545,12 @@
"SELECT filename, myname, force FROM dirty WHERE peername = '%s' "
"ORDER by filename ASC", url_encode(peername))
{
- const char *filename = url_decode(SQL_V[0]);
+ const char *filename = url_decode(SQL_V(0));
int i, use_this = patnum == 0;
for (i=0; i<patnum && !use_this; i++)
if ( compare_files(filename, patlist[i], recursive) ) use_this = 1;
if (use_this)
- textlist_add2(&tl, filename, url_decode(SQL_V[1]), atoi(SQL_V[2]));
+ textlist_add2(&tl, filename, url_decode(SQL_V(1)), atoi(SQL_V(2)));
} SQL_END;
/* just return if there are no files to update */
@@ -626,7 +626,7 @@
SQL_BEGIN("Get hosts from dirty table",
"SELECT peername FROM dirty GROUP BY peername ORDER BY random()")
{
- textlist_add(&tl, url_decode(SQL_V[0]), 0);
+ textlist_add(&tl, url_decode(SQL_V(0)), 0);
} SQL_END;
for (t = tl; t != 0; t = t->next) {
@@ -798,7 +798,7 @@
filename ? url_encode(filename) : "",
filename ? "'" : "")
{
- char *l_file = strdup(url_decode(SQL_V[1])), *l_checktxt = strdup(url_decode(SQL_V[0]));
+ char *l_file = strdup(url_decode(SQL_V(1))), *l_checktxt = strdup(url_decode(SQL_V(0)));
if ( csync_match_file_host(l_file, myname, peername, 0) ) {
if ( remote_eof ) {
got_remote_eof:
@@ -936,17 +936,17 @@
const struct csync_group *g = 0;
const struct csync_group_host *h;
- const char *filename = url_decode(SQL_V[0]);
+ const char *filename = url_decode(SQL_V(0));
while ((g=csync_find_next(g, filename)) != 0) {
- if (!strcmp(g->myname, SQL_V[1]))
+ if (!strcmp(g->myname, SQL_V(1)))
for (h = g->host; h; h = h->next) {
- if (!strcmp(h->hostname, SQL_V[2]))
+ if (!strcmp(h->hostname, SQL_V(2)))
goto this_dirty_record_is_ok;
}
}
- textlist_add2(&tl, SQL_V[0], SQL_V[2], 0);
+ textlist_add2(&tl, SQL_V(0), SQL_V(2), 0);
this_dirty_record_is_ok:
;
@@ -962,8 +962,8 @@
SQL_BEGIN("Query file DB",
"SELECT filename FROM file")
{
- if (!csync_find_next(0, url_decode(SQL_V[0])))
- textlist_add(&tl, SQL_V[0], 0);
+ if (!csync_find_next(0, url_decode(SQL_V(0))))
+ textlist_add(&tl, SQL_V(0), 0);
} SQL_END;
for (t = tl; t != 0; t = t->next) {
csync_debug(1, "Removing %s from file db.\n", t->value);
More information about the Csync2
mailing list