diff --git a/src/csync.c b/src/csync.c index 221113af1..156513598 100644 --- a/src/csync.c +++ b/src/csync.c @@ -188,13 +188,11 @@ int csync_init(CSYNC *ctx) { goto out; } -#ifndef _WIN32 if (csync_lock(ctx, lock) < 0) { ctx->error_code = CSYNC_ERR_LOCK; rc = -1; goto out; } -#endif /* load config file */ if (asprintf(&config, "%s/%s", ctx->options.config_dir, CSYNC_CONF_FILE) < 0) { @@ -736,12 +734,10 @@ int csync_destroy(CSYNC *ctx) { /* clear exclude list */ csync_exclude_destroy(ctx); -#ifndef _WIN32 /* remove the lock file */ if (asprintf(&lock, "%s/%s", ctx->options.config_dir, CSYNC_LOCK_FILE) > 0) { csync_lock_remove(ctx, lock); } -#endif while (ctx->progress) { csync_progressinfo_t *next = ctx->progress->next; diff --git a/src/csync_lock.c b/src/csync_lock.c index c64df0acb..57d20c747 100644 --- a/src/csync_lock.c +++ b/src/csync_lock.c @@ -181,6 +181,7 @@ static pid_t _csync_lock_read(CSYNC *ctx, const char *lockfile) { } int csync_lock(CSYNC *ctx, const char *lockfile) { +#ifndef _WIN32 /* Check if lock already exists. */ if (_csync_lock_read(ctx, lockfile) > 0) { CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "Aborting, another synchronization process is running."); @@ -190,9 +191,14 @@ int csync_lock(CSYNC *ctx, const char *lockfile) { CSYNC_LOG(CSYNC_LOG_PRIORITY_INFO, "Creating lock file: %s", lockfile); return _csync_lock_create(ctx, lockfile); +#else + return 0; +#endif + } void csync_lock_remove(CSYNC *ctx, const char *lockfile) { +#ifndef _WIN32 char errbuf[256] = {0}; /* You can't remove the lock if it is from another process */ if (_csync_lock_read(ctx, lockfile) == getpid()) { @@ -205,5 +211,6 @@ void csync_lock_remove(CSYNC *ctx, const char *lockfile) { errbuf); } } +#endif }