35FILE_RCSID(
"@(#)$File: fsmagic.c,v 1.85 2022/12/26 17:31:14 christos Exp $")
46# include <sys/mkdev.h>
49#ifdef HAVE_SYS_SYSMACROS_H
50# include <sys/sysmacros.h>
52#ifdef MAJOR_IN_SYSMACROS
55#if defined(major) && !defined(HAVE_MAJOR)
60# define WIN32_LEAN_AND_MEAN
65# define major(dev) (((dev) >> 8) & 0xff)
66# define minor(dev) ((dev) & 0xff)
99#define COMMA (did++ ? ", " : "")
108 fn, strerror(
errno)) == -1)
114 if (!mime && !silent) {
116 if (sb->st_mode & S_ISUID)
121 if (sb->st_mode & S_ISGID)
126 if (sb->st_mode & S_ISVTX)
132 switch (sb->st_mode & S_IFMT) {
149# ifdef HAVE_STAT_ST_RDEV
151 if (
file_printf(ms,
"%scharacter special (%d/%d/%d)",
152 COMMA,
major(sb->st_rdev), dv_unit(sb->st_rdev),
153 dv_subunit(sb->st_rdev)) == -1)
156 if (
file_printf(ms,
"%scharacter special (%ld/%ld)",
158 (
long)
minor(sb->st_rdev)) == -1)
240 file_error(ms, 0,
"invalid mode 0%o", sb->st_mode);
245 if (!silent && !mime && did &&
ret == 0) {
253 if (
ret == 1 && silent)
file_protected int file_printf(struct magic_set *, const char *,...) __attribute__((__format__(__printf__
file_protected void file_error(struct magic_set *, int, const char *,...) __attribute__((__format__(__printf__
file_protected int file_fsmagic(struct magic_set *ms, const char *fn, zend_stat_t *sb)
file_private int handle_mime(struct magic_set *ms, int mime, const char *str)
#define MAGIC_MIME_ENCODING