#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: apprentice.c,v 1.249 2016/05/17 21:43:07 christos Exp $")
+FILE_RCSID("@(#)$File: apprentice.c,v 1.250 2016/07/05 19:20:19 christos Exp $")
#endif /* lint */
#include "magic.h"
#ifndef COMPILE_ONLY
map = apprentice_map(ms, fn);
+ if (map == (struct magic_map *)-1)
+ goto fail;
if (map == NULL) {
if (ms->flags & MAGIC_CHECK)
file_magwarn(ms, "using regular magic file `%s'", fn);
struct stat st;
char *dbname = NULL;
struct magic_map *map;
+ struct magic_map *rv = NULL;
fd = -1;
if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
(void)close(fd);
fd = -1;
- if (check_buffer(ms, map, dbname) != 0)
+ if (check_buffer(ms, map, dbname) != 0) {
+ rv = (struct magic_map *)-1;
goto error;
+ }
#ifdef QUICK
if (mprotect(map->p, (size_t)st.st_size, PROT_READ) == -1) {
file_error(ms, errno, "cannot mprotect `%s'", dbname);
(void)close(fd);
apprentice_unmap(map);
free(dbname);
- return NULL;
+ return rv;
}
private int
*/
/*
* file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.178 2016/03/31 17:51:12 christos Exp $
+ * @(#)$File: file.h,v 1.179 2016/07/05 19:20:19 christos Exp $
*/
#ifndef __file_h__
or directory */
#define MAXDESC 64 /* max len of text description/MIME type */
#define MAXMIME 80 /* max len of text MIME type */
-#define MAXstring 64 /* max len of "string" types */
+#define MAXstring 96 /* max len of "string" types */
#define MAGICNO 0xF11E041C
-#define VERSIONNO 13
-#define FILE_MAGICSIZE 312
+#define VERSIONNO 14
+#define FILE_MAGICSIZE 344
#define FILE_LOAD 0
#define FILE_CHECK 1