aboutsummaryrefslogtreecommitdiff
path: root/contrib/file/is_tar.c
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2009-05-04 00:37:44 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2009-05-04 00:37:44 +0000
commit7dbb948b5f00eabb81904e9db0aa9fc712939aca (patch)
tree12756817ab8bc4334652c625c7731c9e7fd0cefc /contrib/file/is_tar.c
parent8ee6f90a0c45383950152583c7fd62172e27bb73 (diff)
parent4f3dd34290f174adbda2b9668cc6b6c554ae9bb0 (diff)
Merge vendor/file/dist@191739, bringing FILE 5.00 to 8-CURRENT.
Notes
Notes: svn path=/head/; revision=191771
Diffstat (limited to 'contrib/file/is_tar.c')
-rw-r--r--contrib/file/is_tar.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/contrib/file/is_tar.c b/contrib/file/is_tar.c
index a9311117ed24..f962edbd8ee3 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;