summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/config-parser.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/config-parser.c b/shared/config-parser.c
index 4542ca61..ff6814ce 100644
--- a/shared/config-parser.c
+++ b/shared/config-parser.c
@@ -326,6 +326,7 @@ weston_config_parse(const char *name)
{
FILE *fp;
char line[512], *p;
+ struct stat filestat;
struct weston_config *config;
struct weston_config_section *section = NULL;
int i, fd;
@@ -342,6 +343,13 @@ weston_config_parse(const char *name)
return NULL;
}
+ if (fstat(fd, &filestat) < 0 ||
+ !S_ISREG(filestat.st_mode)) {
+ close(fd);
+ free(config);
+ return NULL;
+ }
+
fp = fdopen(fd, "r");
if (fp == NULL) {
free(config);