diff options
Diffstat (limited to 'contrib/file/is_tar.c')
-rw-r--r-- | contrib/file/is_tar.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/contrib/file/is_tar.c b/contrib/file/is_tar.c index a931111..f962edb 100644 --- a/contrib/file/is_tar.c +++ b/contrib/file/is_tar.c @@ -38,16 +38,16 @@ */ #include "file.h" + +#ifndef lint +FILE_RCSID("@(#)$File: is_tar.c,v 1.36 2009/02/03 20:27:51 christos Exp $") +#endif + #include "magic.h" #include <string.h> #include <ctype.h> -#include <sys/types.h> #include "tar.h" -#ifndef lint -FILE_RCSID("@(#)$File: is_tar.c,v 1.31 2008/02/04 20:51:17 christos Exp $") -#endif - #define isodigit(c) ( ((c) >= '0') && ((c) <= '7') ) private int is_tar(const unsigned char *, size_t); @@ -66,16 +66,17 @@ file_is_tar(struct magic_set *ms, const unsigned char *buf, size_t nbytes) * Do the tar test first, because if the first file in the tar * archive starts with a dot, we can confuse it with an nroff file. */ - int tar = is_tar(buf, nbytes); + int tar; int mime = ms->flags & MAGIC_MIME; - if (tar < 1 || tar > 3) + if ((ms->flags & MAGIC_APPLE) != 0) return 0; - if (mime == MAGIC_MIME_ENCODING) + tar = is_tar(buf, nbytes); + if (tar < 1 || tar > 3) return 0; - if (file_printf(ms, mime ? "application/x-tar" : + if (file_printf(ms, "%s", mime ? "application/x-tar" : tartype[tar - 1]) == -1) return -1; return 1; |