From: Eric Bollengier Date: Thu, 9 Mar 2023 15:49:46 +0000 (+0100) Subject: Fix estimate code with limit X-Git-Tag: Beta-15.0.0~229 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=526eb3dbcae111308d5957e9d5a56d78236915db;p=thirdparty%2Fbacula.git Fix estimate code with limit --- diff --git a/bacula/src/findlib/find_one.c b/bacula/src/findlib/find_one.c index 7e58b5073..7c5089b1f 100644 --- a/bacula/src/findlib/find_one.c +++ b/bacula/src/findlib/find_one.c @@ -823,11 +823,15 @@ find_one_file(JCR *jcr, FF_PKT *ff_pkt, * before traversing it. */ rtn_stat = 1; - while (!job_canceled(jcr) && rtn_stat == 1) { + while (!job_canceled(jcr)) { char *p, *q, *s; int l; int i; + if (jcr->estimate_limit > 0 && jcr->JobFiles >= jcr->estimate_limit) { + Dmsg0(10, "We have reached the number of items to display in estimate\n"); + break; + } status = breaddir(directory, dname.addr()); if (status != 0) { /* error or end of directory */ diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 7dbf1cbdf..b40ad7be8 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -362,6 +362,7 @@ public: char StatusInfo[MAX_NAME_LENGTH]; /* Additionnal information about the error status */ time_t last_stat_time; /* Last time stats sent to Dir */ time_t stat_interval; /* Stats send interval default 30s, set to -1 to disable */ + uint32_t estimate_limit; /* Number of files to display in estimate */ uint32_t getErrors() { return JobErrors + SDErrors; }; /* Get error count */ bool sendProgressStatus(); /* Send the progress status to the dir (SD/FD) */ @@ -475,7 +476,6 @@ public: int incremental; /* set if incremental for SINCE */ utime_t mtime; /* begin time for SINCE */ int listing; /* job listing in estimate */ - int estimate_limit; /* Number of files to display in estimate */ long Ticket; /* Ticket */ char *big_buf; /* I/O buffer */ POOLMEM *compress_buf; /* Compression buffer */