From d3d49ea7e243d0f061c2d1797da166f2cf4b9afd Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 1 Dec 2008 18:38:49 +0100 Subject: Fix a typo in README. --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index f4fbad2..5cc2914 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ sparse or snapshots become older than the specified time. dss is also user-friendly because users can browse the snapshot directories without admin intervention and see the contents of the file system at the various times a snapshot was taken. In particular, users -can easily restore accidently removed files by using their favorite +can easily restore accidentally removed files by using their favorite file browser to simply copy files from the snapshot directory back to the live system. -- cgit v1.2.3 From 006e516739869cba59b3be6e15a2879273c53cfe Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 8 Dec 2008 17:17:50 +0100 Subject: Fix check when to use rsync locally. We can do this if (a) remote_host_arg is "localhost" and (b) remote_user_arg is the same as logname. The old code only looked at the logname and thus tried to use rsync locally even if a remote_host_arg was specified. --- dss.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/dss.c b/dss.c index af02f1c..f8a1e51 100644 --- a/dss.c +++ b/dss.c @@ -695,6 +695,21 @@ out: return ret; } +/* + * We can not use rsync locally if the local user is different from the remote + * user or if the src dir is not on the local host (or both). + */ +static int use_rsync_locally(char *logname) +{ + char *h = conf.remote_host_arg; + + if (strcmp(h, "localhost") && strcmp(h, "127.0.0.1")) + return 0; + if (conf.remote_user_given && strcmp(conf.remote_user_arg, logname)) + return 0; + return 1; +} + static void create_rsync_argv(char ***argv, int64_t *num) { char *logname, *newest; @@ -718,7 +733,7 @@ static void create_rsync_argv(char ***argv, int64_t *num) } else DSS_INFO_LOG("no previous snapshot found\n"); logname = dss_logname(); - if (conf.remote_user_given && !strcmp(conf.remote_user_arg, logname)) + if (use_rsync_locally(logname)) (*argv)[i++] = dss_strdup(conf.source_dir_arg); else (*argv)[i++] = make_message("%s@%s:%s/", conf.remote_user_given? -- cgit v1.2.3 From a883830b42e84c58233efcf05c16e9aa4bb7597f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 11 Dec 2008 14:07:49 +0100 Subject: Add some comments to compute_next_snapshot_time(). Also, move the call to gettimeofday() down to where it is needed. --- dss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dss.c b/dss.c index f8a1e51..c4349a8 100644 --- a/dss.c +++ b/dss.c @@ -175,13 +175,13 @@ static void compute_next_snapshot_time(void) tmp.tv_sec = x; tmp.tv_usec = 0; ret = tv_diff(&unit_interval, &tmp, &diff); /* total sleep time per unit interval */ - gettimeofday(&now, NULL); - if (ret < 0 || !s) + if (ret < 0 || !s) /* unit_interval < tmp or no snapshot */ goto min_sleep; tv_divide(wanted, &diff, &tmp); /* sleep time betweeen two snapshots */ - diff.tv_sec = s->completion_time; + diff.tv_sec = s->completion_time; /* completion time of the the latest snaphot */ diff.tv_usec = 0; tv_add(&diff, &tmp, &next_snapshot_time); + gettimeofday(&now, NULL); if (tv_diff(&now, &next_snapshot_time, NULL) < 0) goto out; min_sleep: -- cgit v1.2.3