X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=dss.c;h=bcaeff2dbba49cf1c1733530818f82871f16bb7b;hb=14e9d97693f19b79ff4adbfa1a1272b8f81cf986;hp=a782a2e26b5562c0293e5b38d425be480610ba04;hpb=1f5ecfacc341f893d73caa0a613d553af33a6cc9;p=dss.git diff --git a/dss.c b/dss.c index a782a2e..bcaeff2 100644 --- a/dss.c +++ b/dss.c @@ -413,7 +413,8 @@ static void dss_get_snapshot_list(struct snapshot_list *sl) static int64_t compute_next_snapshot_time(void) { int64_t x = 0, now = get_current_time(), unit_interval - = 24 * 3600 * OPT_UINT32_VAL(DSS, UNIT_INTERVAL), ret; + = 24 * 3600 * OPT_UINT32_VAL(DSS, UNIT_INTERVAL), ret, + last_completion_time; unsigned wanted = desired_number_of_snapshots(0, OPT_UINT32_VAL(DSS, NUM_INTERVALS)), num_complete = 0; @@ -427,6 +428,7 @@ static int64_t compute_next_snapshot_time(void) continue; num_complete++; x += s->completion_time - s->creation_time; + last_completion_time = s->completion_time; } assert(x >= 0); @@ -436,7 +438,7 @@ static int64_t compute_next_snapshot_time(void) x /= num_complete; /* avg time to create one snapshot */ if (unit_interval < x * wanted) /* oops, no sleep at all */ goto out; - ret = s->completion_time + unit_interval / wanted - x; + ret = last_completion_time + unit_interval / wanted - x; out: free_snapshot_list(&sl); return ret; @@ -1299,9 +1301,7 @@ static int handle_signal(void) switch (sig) { case SIGINT: case SIGTERM: - kill_children(); - ret = -E_SIGNAL; - break; + return -E_SIGNAL; case SIGHUP: ret = handle_sighup(); break; @@ -1448,6 +1448,7 @@ static int create_snapshot(char **argv) { int ret; + assert(argv); ret = rename_resume_snap(current_snapshot_creation_time); if (ret < 0) return ret; @@ -1777,7 +1778,7 @@ static void handle_version_and_help(void) else if (OPT_GIVEN(DSS, HELP)) txt = lls_short_help(CMD_PTR(DSS)); else if (OPT_GIVEN(DSS, VERSION)) - txt = dss_strdup(VERSION_STRING); + txt = make_message("%s\n", VERSION_STRING); else return; printf("%s", txt);