mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-28 19:58:56 +03:00
Remove WIN32 preprocessor directive from csync.c.
This commit is contained in:
parent
2b971a09f3
commit
84f425a326
2 changed files with 7 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue