summaryrefslogtreecommitdiff
path: root/sys/src/9/port/rebootcmd.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-07-10 23:56:39 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-07-10 23:56:39 +0200
commit4ec93f94c92eec46433a962eb0f86b6f27909e6c (patch)
treeb34373278a5e12ed6a12edbbd59b21a6c01ed062 /sys/src/9/port/rebootcmd.c
parent3ca9ac70c4f41ff57617d4cfcf46caa304db9a01 (diff)
kernel: use HDR_MAGIC constant to handle Exec header extension, make rebootcmd() handle AOUT_MAGIC macro
Diffstat (limited to 'sys/src/9/port/rebootcmd.c')
-rw-r--r--sys/src/9/port/rebootcmd.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/src/9/port/rebootcmd.c b/sys/src/9/port/rebootcmd.c
index fb64b2bee..537c4e7cf 100644
--- a/sys/src/9/port/rebootcmd.c
+++ b/sys/src/9/port/rebootcmd.c
@@ -70,14 +70,17 @@ rebootcmd(int argc, char *argv[])
text = l2be(exec.text);
data = l2be(exec.data);
- if(AOUT_MAGIC == S_MAGIC || AOUT_MAGIC == I_MAGIC){
- if(magic != S_MAGIC && magic != I_MAGIC)
+ if(!(magic == AOUT_MAGIC)){
+ switch(magic){
+ case I_MAGIC:
+ case S_MAGIC:
+ if((I_MAGIC == AOUT_MAGIC) || (S_MAGIC == AOUT_MAGIC))
+ break;
+ default:
error(Ebadexec);
- } else if(magic != AOUT_MAGIC)
- error(Ebadexec);
-
- /* amd64 extra header */
- if(magic == S_MAGIC)
+ }
+ }
+ if(magic & HDR_MAGIC)
readn(c, &exec, 8);
/* round text out to page boundary */