Browse Source

Finish up fexec migration

jD91mZM2 6 years ago
parent
commit
128209788c
2 changed files with 5 additions and 3 deletions
  1. 3 1
      src/crt0/src/lib.rs
  2. 2 2
      src/platform/src/redox/mod.rs

+ 3 - 1
src/crt0/src/lib.rs

@@ -98,7 +98,9 @@ pub unsafe extern "C" fn _start_rust(sp: &'static Stack) -> ! {
     platform::exit(main(
         argc,
         argv,
-        envp
+        // not envp, because programs like bash try to modify this *const*
+        // pointer :|
+        platform::environ as *const *const c_char
     ));
 }
 

+ 2 - 2
src/platform/src/redox/mod.rs

@@ -219,7 +219,7 @@ pub unsafe extern "C" fn execve(
         while *arg.offset(len) != 0 {
             len += 1;
         }
-        args.push([*arg as usize, len as usize]);
+        args.push([arg as usize, len as usize]);
         argv = argv.offset(1);
     }
 
@@ -236,7 +236,7 @@ pub unsafe extern "C" fn execve(
         while *env.offset(len) != 0 {
             len += 1;
         }
-        envs.push([*env as usize, len as usize]);
+        envs.push([env as usize, len as usize]);
         envp = envp.offset(1);
     }