]> granicus.if.org Git - file/commitdiff
fix bug in previous.
authorChristos Zoulas <christos@zoulas.com>
Tue, 10 Aug 2010 09:53:32 +0000 (09:53 +0000)
committerChristos Zoulas <christos@zoulas.com>
Tue, 10 Aug 2010 09:53:32 +0000 (09:53 +0000)
src/magic.c

index bdbff715ab1dee049d8ba17425fd4cb49f84ceb3..0a65601daf5748ce1f905965a1d89c729545f698 100644 (file)
@@ -33,7 +33,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: magic.c,v 1.65 2009/09/14 17:50:38 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.66 2010/07/21 16:47:17 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -99,7 +99,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
 {
        if (dllpath[0] == 0 &&
            GetModuleFileNameA(hinstDLL, dllpath, MAX_PATH) != 0)
-               PathRemoveFileSpec(dllpath);
+               PathRemoveFileSpecA(dllpath);
        return TRUE;
 }
 #endif
@@ -107,7 +107,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
 private const char *
 get_default_magic(void)
 {
-       static const char hmagic[] = "/.magic";
+       static const char hmagic[] = "/.magic/magic.mgc";
        static char default_magic[2 * MAXPATHLEN + 2];
        char *home;
        char hmagicpath[MAXPATHLEN + 1] = {0};
@@ -302,6 +302,14 @@ magic_check(struct magic_set *ms, const char *magicfile)
        return ml ? 0 : -1;
 }
 
+public int
+magic_list(struct magic_set *ms, const char *magicfile)
+{
+       struct mlist *ml = file_apprentice(ms, magicfile, FILE_LIST);
+       free_mlist(ml);
+       return ml ? 0 : -1;
+}
+
 private void
 close_and_restore(const struct magic_set *ms, const char *name, int fd,
     const struct stat *sb)