-#if defined(USE_MAGIC_MIME_TYPE)
-
-#if !defined(MAGIC_DB)
-#define MAGIC_DB "/usr/share/misc/magic.mgc"
-#endif
-
-static int init_lib_magic (AFB_session *session)
-{
- /* MAGIC_MIME tells magic to return a mime of the file, but you can specify different things */
- if (verbosity)
- printf("Loading mimetype default magic database\n");
-
- session->magic = magic_open(MAGIC_MIME_TYPE);
- if (session->magic == NULL) {
- fprintf(stderr,"ERROR: unable to initialize magic library\n");
- return 0;
- }
-
- /* Warning: should not use NULL for DB [libmagic bug wont pass efence check] */
- if (magic_load(session->magic, MAGIC_DB) != 0) {
- fprintf(stderr,"cannot load magic database - %s\n", magic_error(session->magic));
- magic_close(session->magic);
- session->magic = NULL;
- return 0;
- }
-
- return 1;
-}
-#endif
-