summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2013-11-27 22:21:59 +0000
committerVincent Sanders <vince@netsurf-browser.org>2013-11-27 22:21:59 +0000
commitf725c2dcdef846c8ac079b082bce53b98da61c12 (patch)
tree6f765c1f19592fb9bb774e3ddb5f30a5002513b6
parent47c17ad8895f6287ee38b18ec52dd9571fbea5c5 (diff)
downloadnetsurf-f725c2dcdef846c8ac079b082bce53b98da61c12.tar.gz
netsurf-f725c2dcdef846c8ac079b082bce53b98da61c12.tar.bz2
check stat error return (coverity 1109835)
-rw-r--r--gtk/filetype.c6
1 files changed, 5 insertions, 1 deletions
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";