use cli_regcomp(), instead of regcomp().

[patch idea approved by TK]


git-svn: trunk@3235
remotes/push_mirror/metadata
Török Edvin 18 years ago
parent cbc69ae811
commit f33a4e578d
  1. 4
      ChangeLog
  2. 16
      clamscan/others.c

@ -1,3 +1,7 @@
Fri Sep 21 00:18:08 EEST 2007(edwin)
------------------------------------
* clamscan/others.c: use cli_regcomp(), instead of regcomp().
Fri Sep 21 00:13:32 EEST 2007(edwin)
------------------------------------
* configure, configure.in: add check to detect certain compiler bugs that

@ -43,9 +43,7 @@
#include <signal.h>
#include <target.h>
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
#include "regex/regex.h"
#include "shared/output.h"
#include "others.h"
@ -130,22 +128,18 @@ int checkaccess(const char *path, const char *username, int mode)
int match_regex(const char *filename, const char *pattern)
{
#ifdef HAVE_REGEX_H
regex_t reg;
int match, flags;
#if !defined(C_CYGWIN) && !defined(C_OS2)
flags = REG_EXTENDED;
#else
flags = REG_EXTENDED | REG_ICASE; /* case insensitive on Windows */
#endif
if(regcomp(&reg, pattern, flags) != 0) {
#endif
if(cli_regcomp(&reg, pattern, flags) != 0) {
logg("!%s: Could not parse regular expression %s.\n", filename, pattern);
return 2;
}
match = (regexec(&reg, filename, 0, NULL, 0) == REG_NOMATCH) ? 0 : 1;
regfree(&reg);
match = (cli_regexec(&reg, filename, 0, NULL, 0) == REG_NOMATCH) ? 0 : 1;
cli_regfree(&reg);
return match;
#else /* HAVE_REGEX_H */
return strstr(filename, pattern) ? 1 : 0;
#endif
}

Loading…
Cancel
Save