From dc9fa15a48ef572a4bd26e9449a65c59d1d495ce Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 20 Apr 2013 23:55:16 +0200 Subject: Ignore backup files --- src/config.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/config.c b/src/config.c index cf95fb7..b042f95 100644 --- a/src/config.c +++ b/src/config.c @@ -132,7 +132,7 @@ static bool config_match(const char *opt, ...) { va_list ap; bool match = false; const char *str; - + va_start(ap, opt); while((str = va_arg(ap, const char*)) != NULL) { @@ -351,6 +351,11 @@ static void read_peer_dir(fastd_context_t *ctx, fastd_config_t *conf, const char if (result->d_name[0] == '.') continue; + if (result->d_name[strlen(result->d_name)-1] == '~') { + pr_verbose(ctx, "ignoring file `%s' as it seems to be a backup file", result->d_name); + continue; + } + struct stat statbuf; if (stat(result->d_name, &statbuf)) { pr_warn(ctx, "ignoring file `%s': stat failed: %s", result->d_name, strerror(errno)); -- cgit v1.2.3