Lines Matching defs:ms

68 bad_link(struct magic_set *ms, int err, char *buf)
70 int mime = ms->flags & MAGIC_MIME;
72 file_printf(ms, "inode/symlink")
76 if (ms->flags & MAGIC_ERROR) {
77 file_error(ms, err,
81 if (file_printf(ms, "broken symbolic link to %s", buf) == -1)
88 handle_mime(struct magic_set *ms, int mime, const char *str)
91 if (file_printf(ms, "inode/%s", str) == -1)
93 if ((mime & MAGIC_MIME_ENCODING) && file_printf(ms,
97 if ((mime & MAGIC_MIME_ENCODING) && file_printf(ms, "binary") == -1)
103 file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
106 int mime = ms->flags & MAGIC_MIME;
113 if (ms->flags & MAGIC_APPLE)
124 if ((ms->flags & MAGIC_SYMLINK) == 0)
160 if (ms->flags & MAGIC_ERROR) {
161 file_error(ms, errno, "cannot stat `%s'", fn);
164 if (file_printf(ms, "cannot open `%s' (%s)",
174 if (file_printf(ms, "%ssetuid", COMMA) == -1)
179 if (file_printf(ms, "%ssetgid", COMMA) == -1)
184 if (file_printf(ms, "%ssticky", COMMA) == -1)
192 if (handle_mime(ms, mime, "directory") == -1)
194 } else if (file_printf(ms, "%sdirectory", COMMA) == -1)
204 if ((ms->flags & MAGIC_DEVICES) != 0) {
209 if (handle_mime(ms, mime, "chardevice") == -1)
214 if (file_printf(ms, "%scharacter special (%d/%d/%d)",
219 if (file_printf(ms, "%scharacter special (%ld/%ld)",
225 if (file_printf(ms, "%scharacter special", COMMA) == -1)
238 if ((ms->flags & MAGIC_DEVICES) != 0) {
243 if (handle_mime(ms, mime, "blockdevice") == -1)
248 if (file_printf(ms, "%sblock special (%d/%d/%d)",
253 if (file_printf(ms, "%sblock special (%ld/%ld)",
259 if (file_printf(ms, "%sblock special", COMMA) == -1)
268 if((ms->flags & MAGIC_DEVICES) != 0)
271 if (handle_mime(ms, mime, "fifo") == -1)
273 } else if (file_printf(ms, "%sfifo (named pipe)", COMMA) == -1)
280 if (handle_mime(ms, mime, "door") == -1)
282 } else if (file_printf(ms, "%sdoor", COMMA) == -1)
289 if (ms->flags & MAGIC_ERROR) {
290 file_error(ms, errno, "unreadable symlink `%s'",
295 if (handle_mime(ms, mime, "symlink") == -1)
297 } else if (file_printf(ms,
308 return bad_link(ms, errno, buf);
317 if (ms->flags & MAGIC_ERROR) {
318 file_error(ms, 0,
323 if (handle_mime(ms, mime,
326 } else if (file_printf(ms,
340 return bad_link(ms, errno, buf);
344 if ((ms->flags & MAGIC_SYMLINK) != 0) {
346 ms->flags &= MAGIC_SYMLINK;
347 p = magic_file(ms, buf);
348 ms->flags |= MAGIC_SYMLINK;
353 if (handle_mime(ms, mime, "symlink") == -1)
355 } else if (file_printf(ms, "%ssymbolic link to %s",
365 if (handle_mime(ms, mime, "socket") == -1)
367 } else if (file_printf(ms, "%ssocket", COMMA) == -1)
385 if ((ms->flags & MAGIC_DEVICES) == 0 && sb->st_size == 0) {
387 if (handle_mime(ms, mime, "x-empty") == -1)
389 } else if (file_printf(ms, "%sempty", COMMA) == -1)
397 file_error(ms, 0, "invalid mode 0%o", sb->st_mode);
403 if (file_printf(ms, " ") == -1)