From 0f35a278a4723f38e7c7a80678fcd59e40451142 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 26 Dec 2009 01:02:10 +0100 Subject: Fix exec shell check for really small files * exec/hashexec.c (check_hashbang): Set `e->error' to 0 before calling map(). On error, check `e->error' instead of `errno', and default `e->error' to ENOEXEC. --- exec/hashexec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'exec/hashexec.c') diff --git a/exec/hashexec.c b/exec/hashexec.c index f880983d..2aa3844b 100644 --- a/exec/hashexec.c +++ b/exec/hashexec.c @@ -127,12 +127,16 @@ check_hashbang (struct execdata *e, name, flags, 0, result); } - const char *page = map (e, 0, 2); + const char *page; char interp_buf[vm_page_size - 2 + 1]; + e->error = 0; + page = map (e, 0, 2); + if (!page) { - e->error = errno; + if (!e->error) + e->error = ENOEXEC; return; } -- cgit v1.2.3