summaryrefslogtreecommitdiff
path: root/mimetypes/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'mimetypes/eval.c')
-rw-r--r--mimetypes/eval.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mimetypes/eval.c b/mimetypes/eval.c
index b2ad941..120d041 100644
--- a/mimetypes/eval.c
+++ b/mimetypes/eval.c
@@ -5,6 +5,7 @@
#include <inttypes.h>
#include <ctype.h>
#include <errno.h>
+#include <sys/stat.h>
#include "mtint.h"
static int eval_rule (struct node *root, struct filebuf const *file);
@@ -404,7 +405,13 @@ get_file_type (char const *filename)
struct rule *r;
struct rule *last = NULL;
struct filebuf fb;
+ struct stat st;
+ if (stat (filename, &st))
+ mimetypes_error ("can't stat %s: %s", filename, strerror (errno));
+ else if (S_ISDIR (st.st_mode))
+ return "directory";
+
fb.name = filename;
fb.fp = fopen (filename, "r");
if (fb.fp == NULL)

Return to:

Send suggestions and report system problems to the System administrator.