Skip to content

Commit 3a9b580

Browse files
authored
Merge pull request davisjam#47 from davisjam/FixCacheClientPath
check-regex: fix path to cache-client.js
2 parents 6162706 + 2d738ce commit 3a9b580

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

bin/check-regex.pl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
my $detectVuln = "$ENV{VULN_REGEX_DETECTOR_ROOT}/src/detect/detect-vuln.pl";
4545
my $validateVuln = "$ENV{VULN_REGEX_DETECTOR_ROOT}/src/validate/validate-vuln.pl";
46+
my $cacheClient = "$ENV{VULN_REGEX_DETECTOR_ROOT}/src/cache/client/cli/cache-client.js"; # We don't need this to work.
4647

4748
for my $script ($detectVuln, $validateVuln) {
4849
if (not -x $script) {
@@ -83,6 +84,12 @@
8384
$useCache = 0;
8485
}
8586

87+
# We can't use the cache if we have no client.
88+
if (not -x $cacheClient) {
89+
&log("Cannot use cache, could not find cacheClient $cacheClient");
90+
$useCache = 0;
91+
}
92+
8693
# Query cache?
8794
my $cacheResponse;
8895
my $cacheHit = 0;
@@ -207,8 +214,7 @@ sub queryCache {
207214
"result" => $PATTERN_UNKNOWN,
208215
};
209216

210-
my $cacheClient = "$ENV{VULN_REGEX_DETECTOR_ROOT}/src/cache/client/cli/cache-client.js";
211-
if (not -f $cacheClient) {
217+
if (not -x $cacheClient) {
212218
&log("queryCache: Could not find client $cacheClient");
213219
return $unknownResponse;
214220
}
@@ -259,8 +265,7 @@ sub queryCache {
259265
sub updateCache {
260266
my ($checkRegexResponse) = @_;
261267

262-
my $cacheClient = "$ENV{VULN_REGEX_DETECTOR_ROOT}/src/cache/client/cache-client.js";
263-
if (not -f $cacheClient) {
268+
if (not -x $cacheClient) {
264269
&log("updateCache: Could not find client $cacheClient");
265270
return;
266271
}

0 commit comments

Comments
 (0)