From 6ee9404767a778664125ed8b04bf2eeb39c904f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Fri, 9 Jan 2015 23:21:17 +0100 Subject: More useful error message when opening non regular files --- text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'text.c') diff --git a/text.c b/text.c index 9afab01..7ffe064 100644 --- a/text.c +++ b/text.c @@ -713,7 +713,7 @@ Text *text_load(const char *filename) { if (fstat(txt->fd, &txt->info) == -1) goto out; if (!S_ISREG(txt->info.st_mode)) { - errno = EISDIR; + errno = S_ISDIR(txt->info.st_mode) ? EISDIR : ENOTSUP; goto out; } // XXX: use lseek(fd, 0, SEEK_END); instead? -- cgit v1.2.3