summaryrefslogtreecommitdiff
path: root/sys/src/9/port/rebootcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/src/9/port/rebootcmd.c')
-rw-r--r--sys/src/9/port/rebootcmd.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/src/9/port/rebootcmd.c b/sys/src/9/port/rebootcmd.c
index 6c6adf95b..fb64b2bee 100644
--- a/sys/src/9/port/rebootcmd.c
+++ b/sys/src/9/port/rebootcmd.c
@@ -69,9 +69,17 @@ rebootcmd(int argc, char *argv[])
entry = l2be(exec.entry);
text = l2be(exec.text);
data = l2be(exec.data);
- if(magic != AOUT_MAGIC)
+
+ if(AOUT_MAGIC == S_MAGIC || AOUT_MAGIC == I_MAGIC){
+ if(magic != S_MAGIC && magic != I_MAGIC)
+ error(Ebadexec);
+ } else if(magic != AOUT_MAGIC)
error(Ebadexec);
+ /* amd64 extra header */
+ if(magic == S_MAGIC)
+ readn(c, &exec, 8);
+
/* round text out to page boundary */
rtext = PGROUND(entry+text)-entry;
size = rtext + data;