... | ... |
@@ -566,6 +566,12 @@ int main(int argc, char **argv) |
566 | 566 |
break; |
567 | 567 |
} |
568 | 568 |
|
569 |
+ if((ret = statinidir_th(dbdir))) { |
|
570 |
+ logg("!%s\n", cl_strerror(ret)); |
|
571 |
+ ret = 1; |
|
572 |
+ break; |
|
573 |
+ } |
|
574 |
+ |
|
569 | 575 |
if (optget(opts, "DisableCertCheck")->enabled) |
570 | 576 |
engine->dconf->pe |= PE_CONF_DISABLECERT; |
571 | 577 |
|
... | ... |
@@ -296,6 +296,15 @@ static const char *get_cmd(struct fd_buf *buf, size_t off, size_t *len, char *te |
296 | 296 |
} |
297 | 297 |
} |
298 | 298 |
|
299 |
+int statinidir_th(const char* dirname) |
|
300 |
+{ |
|
301 |
+ if (!dbstat.entries) { |
|
302 |
+ memset(&dbstat, 0, sizeof(dbstat)); |
|
303 |
+ } |
|
304 |
+ |
|
305 |
+ return cl_statinidir(dirname, &dbstat); |
|
306 |
+} |
|
307 |
+ |
|
299 | 308 |
struct acceptdata { |
300 | 309 |
struct fd_data fds; |
301 | 310 |
struct fd_data recv_fds; |
... | ... |
@@ -1054,7 +1063,6 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi |
1054 | 1054 |
} else { |
1055 | 1055 |
logg("Self checking every %u seconds.\n", selfchk); |
1056 | 1056 |
} |
1057 |
- memset(&dbstat, 0, sizeof(dbstat)); |
|
1058 | 1057 |
|
1059 | 1058 |
/* save the PID */ |
1060 | 1059 |
mainpid = getpid(); |
... | ... |
@@ -1507,4 +1515,4 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi |
1507 | 1507 |
logg("--- Stopped at %s", cli_ctime(¤t_time, timestr, sizeof(timestr))); |
1508 | 1508 |
|
1509 | 1509 |
return ret; |
1510 |
-} |
|
1510 |
+} |
... | ... |
@@ -47,6 +47,7 @@ struct thrwarg { |
47 | 47 |
}; |
48 | 48 |
|
49 | 49 |
int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsigned int dboptions, const struct optstruct *opts); |
50 |
+int statinidir_th(const char* dirname); |
|
50 | 51 |
void sighandler(int sig); |
51 | 52 |
void sighandler_th(int sig); |
52 | 53 |
void sigsegv(int sig); |