From f725c2dcdef846c8ac079b082bce53b98da61c12 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 27 Nov 2013 22:21:59 +0000 Subject: check stat error return (coverity 1109835) --- gtk/filetype.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk/filetype.c b/gtk/filetype.c index f5cf3bfe7..2ae59d867 100644 --- a/gtk/filetype.c +++ b/gtk/filetype.c @@ -157,7 +157,11 @@ const char *fetch_filetype(const char *unix_path) const char *type; int l; - stat(unix_path, &statbuf); + if (stat(unix_path, &statbuf) != 0) { + /* stat failed */ + return "text/plain"; + } + if (S_ISDIR(statbuf.st_mode)) return "application/x-netsurf-directory"; -- cgit v1.2.3