diff --git a/src/csync_propagate.c b/src/csync_propagate.c index a06cf2916..2b9796295 100644 --- a/src/csync_propagate.c +++ b/src/csync_propagate.c @@ -102,8 +102,8 @@ static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) { /* Open the source file */ ctx->replica = srep; flags = O_RDONLY|O_NOFOLLOW; - /* O_NOATIME can only be set by the owner of the file or root */ - if (st->uid == getuid()) { + /* O_NOATIME can only be set by the owner of the file or the superuser */ + if (st->uid == getuid() || geteuid() == 0) { flags |= O_NOATIME; } sfp = csync_vio_open(ctx, suri, O_RDONLY|O_NOFOLLOW, 0); diff --git a/src/csync_update.c b/src/csync_update.c index 47d8cb046..dc214d422 100644 --- a/src/csync_update.c +++ b/src/csync_update.c @@ -237,13 +237,19 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn, unsigned int dept fs = csync_vio_file_stat_new(); if (csync_vio_stat(ctx, filename, fs) == 0) { - if (fs->type == CSYNC_VIO_FILE_TYPE_SYMBOLIC_LINK) { - flag = CSYNC_FTW_FLAG_SLINK; - } else if (fs->type == CSYNC_VIO_FILE_TYPE_DIRECTORY) { - flag = CSYNC_FTW_FLAG_DIR; - } else { - flag = CSYNC_FTW_FLAG_FILE; - } + switch (fs->type) { + case CSYNC_VIO_FILE_TYPE_SYMBOLIC_LINK: + flag = CSYNC_FTW_FLAG_SLINK; + break; + case CSYNC_VIO_FILE_TYPE_DIRECTORY: + flag = CSYNC_FTW_FLAG_DIR; + break; + case CSYNC_VIO_FILE_TYPE_REGULAR: + flag = CSYNC_FTW_FLAG_FILE; + default: + flag = CSYNC_FTW_FLAG_SPEC; + break; + }; } else { flag = CSYNC_FTW_FLAG_NSTAT; } diff --git a/src/csync_update.h b/src/csync_update.h index c06301e0e..0213da897 100644 --- a/src/csync_update.h +++ b/src/csync_update.h @@ -35,6 +35,7 @@ enum csync_ftw_flags_e { CSYNC_FTW_FLAG_DNR, /* Unreadable directory. */ CSYNC_FTW_FLAG_NSTAT, /* Unstatable file. */ CSYNC_FTW_FLAG_SLINK, /* Symbolic link. */ + CSYNC_FTW_FLAG_SPEC, /* Special file (fifo, ...). */ /* These flags are only passed from the `nftw' function. */ CSYNC_FTW_FLAG_DP, /* Directory, all subdirs have been visited. */ CSYNC_FTW_FLAG_SLN /* Symbolic link naming non-existing file. */