diff --git a/VERSION b/VERSION index 3e80806b..52af7168 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.581 +8.3.582 diff --git a/database/DBio.c b/database/DBio.c index fa5afb20..80353ebc 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -98,6 +98,9 @@ extern bool FileLocking; /* Suffix for all Magic files */ char *DBSuffix = ".mag"; +#ifdef HAVE_ZLIB +char *DBZSuffix = ".mag.gz"; +#endif /* Magic units per lambda (2 integers, representing (n / d) */ int DBLambda[2] = {1, 1}; @@ -1483,15 +1486,28 @@ dbReadOpen(cellDef, setFileName, dereference, errptr) /* If dereferencing, then use search paths first */ if (!dereference) + { f = PaLockZOpen(cellDef->cd_file, "r", DBSuffix, ".", (char *) NULL, &filename, &is_locked, &fd); +#ifdef HAVE_ZLIB + if (f == NULL) + f = PaLockZOpen(cellDef->cd_file, "r", DBZSuffix, ".", + (char *) NULL, &filename, &is_locked, &fd); +#endif + } + /* Fall back on the original method of using search paths. */ if (f == NULL) { f = PaLockZOpen(cellDef->cd_name, "r", DBSuffix, Path, CellLibPath, &filename, &is_locked, &fd); +#ifdef HAVE_ZLIB + if (f == NULL) + f = PaLockZOpen(cellDef->cd_file, "r", DBZSuffix, Path, + CellLibPath, &filename, &is_locked, &fd); +#endif if (f != NULL) { @@ -1524,6 +1540,11 @@ dbReadOpen(cellDef, setFileName, dereference, errptr) { f = PaLockZOpen(cellDef->cd_file, "r", DBSuffix, ".", (char *) NULL, &filename, &is_locked, &fd); +#ifdef HAVE_ZLIB + if (f == NULL) + f = PaLockZOpen(cellDef->cd_file, "r", DBZSuffix, ".", + (char *) NULL, &filename, &is_locked, &fd); +#endif if (f != NULL) if (DBVerbose) TxError("Warning: Dereferenced cell \"%s\" not " @@ -1541,6 +1562,11 @@ dbReadOpen(cellDef, setFileName, dereference, errptr) { f = PaLockZOpen(cellDef->cd_name, "r", DBSuffix, Path, CellLibPath, &filename, &is_locked, &fd); +#ifdef HAVE_ZLIB + if (f == NULL) + f = PaLockZOpen(cellDef->cd_name, "r", DBZSuffix, Path, + CellLibPath, &filename, &is_locked, &fd); +#endif if (errptr != NULL) *errptr = errno; }