summaryrefslogtreecommitdiff
path: root/exec
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2009-12-26 01:02:10 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2009-12-26 01:02:10 +0100
commit0f35a278a4723f38e7c7a80678fcd59e40451142 (patch)
treebdddd3a1fac70c75a1e79ef5ae9510e097be3d87 /exec
parent908ba8441182f34a7b565a692ebb60e8af321d17 (diff)
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.
Diffstat (limited to 'exec')
-rw-r--r--exec/hashexec.c8
1 files changed, 6 insertions, 2 deletions
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;
}