Merge remote-tracking branch 'ogoffart/dav' into dav

This commit is contained in:
Klaas Freitag 2013-05-13 15:10:29 +02:00
commit cb0e06e7f8
3 changed files with 35 additions and 7 deletions

View file

@ -739,7 +739,7 @@ int csync_commit(CSYNC *ctx) {
/* maybe the propagate was done using another propagator, let the merger think it has been done */
if (!ctx->error_code == CSYNC_ERR_NONE)
if (ctx->error_code == CSYNC_ERR_NONE)
ctx->status = CSYNC_STATUS_DONE;
ctx->error_code = CSYNC_ERR_NONE;

View file

@ -248,12 +248,34 @@ out:
int csync_statedb_write(CSYNC *ctx) {
/* drop tables */
if (csync_statedb_drop_tables(ctx) < 0) {
return -1;
goto retry_create;
}
/* create tables */
if (csync_statedb_create_tables(ctx) < 0) {
return -1;
goto retry_create;
}
if (0) {
char *statedb_tmp;
int rc;
retry_create:
if (asprintf(&statedb_tmp, "%s.ctmp", ctx->statedb.file) < 0) {
return -1;
}
/* close the temporary database */
sqlite3_close(ctx->statedb.db);
/* remove a possible corrupted file if it exists */
unlink(statedb_tmp);
rc = sqlite3_open(statedb_tmp, &ctx->statedb.db);
SAFE_FREE(statedb_tmp);
if (rc != SQLITE_OK) {
return -1;
}
/* create tables */
if (csync_statedb_create_tables(ctx) < 0) {
return -1;
}
}
/* insert metadata */
@ -796,7 +818,7 @@ c_strlist_t *csync_statedb_query(CSYNC *ctx, const char *statement) {
if (result != NULL) {
c_strlist_destroy(result);
}
result = c_strlist_new(1);
return NULL;
}
if (rc == SQLITE_SCHEMA) {

View file

@ -24,11 +24,17 @@ print "Hello, this is t1, a tester for csync with ownCloud.\n";
# content:
# user => "joe",
# passwd => "XXXXXX",
# url => "http://localhost/oc/remote.php/webdav/"
# url => "http://localhost/oc/remote.php/webdav/",
# ld_libpath => "/home/kf/owncloud.com/buildcsync/modules",
# csync => "/home/kf/owncloud.com/buildcsync/client/ocsync"
my $owncloud = "http://localhost/oc/remote.php/webdav/";
my $user = "joe";
my $passwd = 'XXXXX'; # Mind to be secure.
my $ld_libpath = "/home/kf/owncloud.com/buildcsync/modules";
my $csync = "/home/kf/owncloud.com/buildcsync/client/ocsync";
if( -r "./t1.cfg" ) {
my %config = do 't1.cfg';
@ -38,6 +44,8 @@ if( -r "./t1.cfg" ) {
$user = $config{user} if( $config{user} );
$passwd = $config{passwd} if( $config{passwd} );
$owncloud = $config{url} if( $config{url} );
$ld_libpath = $config{ld_libpath} if( $config{ld_libpath} );
$csync = $config{csync} if( $config{csync} );
print "Read t1.cfg: $config{url}\n";
}
@ -101,8 +109,6 @@ sub csync( $$ )
{
my ($local, $remote) = @_;
my $ld_libpath = "/home/kf/owncloud.com/buildcsync/modules";
my $csync = "/home/kf/owncloud.com/buildcsync/client/ocsync";
my $url = $owncloud;
$url =~ s#^http://##; # Remove the leading http://