diff options
Diffstat (limited to 'Src/Modules')
-rw-r--r-- | Src/Modules/db_gdbm.c | 2 | ||||
-rw-r--r-- | Src/Modules/mapfile.c | 2 | ||||
-rw-r--r-- | Src/Modules/pcre.c | 35 | ||||
-rw-r--r-- | Src/Modules/system.c | 14 | ||||
-rw-r--r-- | Src/Modules/zpty.c | 7 |
5 files changed, 53 insertions, 7 deletions
diff --git a/Src/Modules/db_gdbm.c b/Src/Modules/db_gdbm.c index cf1322459..5f776f407 100644 --- a/Src/Modules/db_gdbm.c +++ b/Src/Modules/db_gdbm.c @@ -98,7 +98,7 @@ static struct builtin bintab[] = { { name, PM_ARRAY | PM_READONLY, (void *) var, NULL, NULL, NULL, NULL } /* Holds names of all tied parameters */ -char **zgdbm_tied; +static char **zgdbm_tied; static struct paramdef patab[] = { ROARRPARAMDEF( "zgdbm_tied", &zgdbm_tied ), diff --git a/Src/Modules/mapfile.c b/Src/Modules/mapfile.c index 2503b361e..7a903418f 100644 --- a/Src/Modules/mapfile.c +++ b/Src/Modules/mapfile.c @@ -198,7 +198,7 @@ get_contents(char *fname) if ((fd = open(fname, O_RDONLY | O_NOCTTY)) >= 0) { LinkList ll; - if ((ll = readoutput(fd, 1))) + if ((ll = readoutput(fd, 1, 0))) val = peekfirst(ll); } #endif /* USE_MMAP */ diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c index 659fd22d5..15ee34bc8 100644 --- a/Src/Modules/pcre.c +++ b/Src/Modules/pcre.c @@ -88,10 +88,19 @@ bin_pcre_compile(char *nam, char **args, Options ops, UNUSED(int func)) if (zpcre_utf8_enabled()) pcre_opts |= PCRE_UTF8; - pcre_hints = NULL; /* Is this necessary? */ +#ifdef HAVE_PCRE_STUDY + if (pcre_hints) +#ifdef PCRE_CONFIG_JIT + pcre_free_study(pcre_hints); +#else + pcre_free(pcre_hints); +#endif + pcre_hints = NULL; +#endif if (pcre_pattern) pcre_free(pcre_pattern); + pcre_pattern = NULL; target = ztrdup(*args); unmetafy(target, &target_len); @@ -128,6 +137,14 @@ bin_pcre_study(char *nam, UNUSED(char **args), UNUSED(Options ops), UNUSED(int f return 1; } + if (pcre_hints) +#ifdef PCRE_CONFIG_JIT + pcre_free_study(pcre_hints); +#else + pcre_free(pcre_hints); +#endif + pcre_hints = NULL; + pcre_hints = pcre_study(pcre_pattern, 0, &pcre_error); if (pcre_error != NULL) { @@ -528,5 +545,21 @@ cleanup_(Module m) int finish_(UNUSED(Module m)) { +#if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC) +#ifdef HAVE_PCRE_STUDY + if (pcre_hints) +#ifdef PCRE_CONFIG_JIT + pcre_free_study(pcre_hints); +#else + pcre_free(pcre_hints); +#endif + pcre_hints = NULL; +#endif + + if (pcre_pattern) + pcre_free(pcre_pattern); + pcre_pattern = NULL; +#endif + return 0; } diff --git a/Src/Modules/system.c b/Src/Modules/system.c index 3eecd7e95..9fd4d2583 100644 --- a/Src/Modules/system.c +++ b/Src/Modules/system.c @@ -649,22 +649,30 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) if (timeout > 0) { time_t end = time(NULL) + (time_t)timeout; while (fcntl(flock_fd, F_SETLK, &lck) < 0) { - if (errflag) + if (errflag) { + zclose(flock_fd); return 1; + } if (errno != EINTR && errno != EACCES && errno != EAGAIN) { + zclose(flock_fd); zwarnnam(nam, "failed to lock file %s: %e", args[0], errno); return 1; } - if (time(NULL) >= end) + if (time(NULL) >= end) { + zclose(flock_fd); return 2; + } sleep(1); } } else { while (fcntl(flock_fd, timeout == 0 ? F_SETLK : F_SETLKW, &lck) < 0) { - if (errflag) + if (errflag) { + zclose(flock_fd); return 1; + } if (errno == EINTR) continue; + zclose(flock_fd); zwarnnam(nam, "failed to lock file %s: %e", args[0], errno); return 1; } diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c index 3c1bef58f..1c93a1d02 100644 --- a/Src/Modules/zpty.c +++ b/Src/Modules/zpty.c @@ -254,7 +254,12 @@ get_pty(int master, int *retfd) #elif defined(__FreeBSD__) || defined(__DragonFly__) static char char1[] = "pqrsPQRS"; static char char2[] = "0123456789abcdefghijklmnopqrstuv"; -#else /* __FreeBSD__ || __DragonFly__ */ +#elif defined(__OpenBSD__) + static char char1[] = "pqrstuvwxyzPQRST"; + static char char2[] = "0123456789" + "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +#else /* __FreeBSD__ || __DragonFly__ || __OpenBSD*/ static char char1[] = "pqrstuvwxyzPQRST"; static char char2[] = "0123456789abcdef"; #endif |