From: Andre Noll Date: Mon, 14 Apr 2008 16:30:50 +0000 (+0200) Subject: dss.c: Sleep at most 60 seconds. X-Git-Tag: v0.0.5~4^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=commitdiff_plain;h=cb2dd233bd5f05ba723df4c39623576aa36b82d2;hp=9f00c1b8d6e8a345aba4ec225d7d90a8a423d5f3 dss.c: Sleep at most 60 seconds. Otherwise we might miss to remove snapshots in time. --- diff --git a/dss.c b/dss.c index 744efaf..6124060 100644 --- a/dss.c +++ b/dss.c @@ -746,7 +746,8 @@ static int create_snapshot(char **argv) static int select_loop(void) { int ret; - struct timeval tv = {.tv_sec = 0, .tv_usec = 0}; + /* check every 60 seconds for free disk space */ + struct timeval tv = {.tv_sec = 60, .tv_usec = 0}; for (;;) { fd_set rfds; @@ -754,9 +755,7 @@ static int select_loop(void) char **rsync_argv; struct timeval now, *tvp = &tv; - if (rsync_pid) - tv.tv_sec = 60; /* check every 60 seconds for free disk space */ - else if (rm_pid) + if (rm_pid) tvp = NULL; /* sleep until rm process dies */ FD_ZERO(&rfds); FD_SET(signal_pipe, &rfds); @@ -781,7 +780,7 @@ static int select_loop(void) } restart_rsync_process(); gettimeofday(&now, NULL); - if (tv_diff(&next_snapshot_time, &now, &tv) > 0) + if (tv_diff(&next_snapshot_time, &now, NULL) > 0) continue; switch (snapshot_creation_status) { case SCS_READY: