diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2013-11-27 22:21:59 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2013-11-27 22:21:59 +0000 |
commit | f725c2dcdef846c8ac079b082bce53b98da61c12 (patch) | |
tree | 6f765c1f19592fb9bb774e3ddb5f30a5002513b6 /gtk/filetype.c | |
parent | 47c17ad8895f6287ee38b18ec52dd9571fbea5c5 (diff) | |
download | netsurf-f725c2dcdef846c8ac079b082bce53b98da61c12.tar.gz netsurf-f725c2dcdef846c8ac079b082bce53b98da61c12.tar.bz2 |
check stat error return (coverity 1109835)
Diffstat (limited to 'gtk/filetype.c')
-rw-r--r-- | gtk/filetype.c | 6 |
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"; |