aboutsummaryrefslogtreecommitdiff
path: root/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'text.c')
-rw-r--r--text.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/text.c b/text.c
index 565505f..89e3512 100644
--- a/text.c
+++ b/text.c
@@ -664,8 +664,10 @@ Text *text_load(const char *filename) {
goto out;
if (fstat(txt->fd, &txt->info) == -1)
goto out;
- if (!S_ISREG(txt->info.st_mode))
+ if (!S_ISREG(txt->info.st_mode)) {
+ errno = EISDIR;
goto out;
+ }
// XXX: use lseek(fd, 0, SEEK_END); instead?
txt->buf.size = txt->info.st_size;
if (txt->buf.size != 0) {