From c5e11bb6cf8c6f8d46ffc6d3c8907d5aca7b1b9e Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 4 Sep 2023 11:44:10 +0200 Subject: [PATCH] apps+base+libc: Use /usr/bin paths instead of /bin everywhere --- apps/login.cpp | 2 +- apps/preinit.cpp | 5 ++--- apps/su.cpp | 2 +- base/etc/passwd | 4 ++-- libc/src/unistd.cpp | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/login.cpp b/apps/login.cpp index 8c6b3d61..80b794f6 100644 --- a/apps/login.cpp +++ b/apps/login.cpp @@ -45,7 +45,7 @@ Result luna_main(int argc, char** argv) username = name.view(); } - execl("/bin/su", "login", "-lp", "--", username.chars(), nullptr); + execl("/usr/bin/su", "login", "-lp", "--", username.chars(), nullptr); perror("su"); return 1; diff --git a/apps/preinit.cpp b/apps/preinit.cpp index e9d99160..95ef37ba 100644 --- a/apps/preinit.cpp +++ b/apps/preinit.cpp @@ -72,10 +72,9 @@ int main() // Now, mount the /dev file system on the new root. mount_devfs(); - setenv("PATH", "/sbin:/usr/bin", 1); - char* argv[] = { "init", nullptr }; + char* argv[] = { "/usr/bin/init", nullptr }; char* envp[] = { nullptr }; - execvpe(argv[0], argv, envp); + execve(argv[0], argv, envp); fail_errno("Failed to execute init"); diff --git a/apps/su.cpp b/apps/su.cpp index cefcecc7..30458101 100644 --- a/apps/su.cpp +++ b/apps/su.cpp @@ -127,7 +127,7 @@ Result luna_main(int argc, char** argv) { chdir(entry->pw_dir); clearenv(); - setenv("PATH", "/bin:/sbin", 1); + setenv("PATH", "/usr/bin:/usr/local/bin", 1); setpgid(0, 0); } diff --git a/base/etc/passwd b/base/etc/passwd index 1abe67ef..2eb5fd77 100644 --- a/base/etc/passwd +++ b/base/etc/passwd @@ -1,2 +1,2 @@ -root:toor:0:0:Administrator:/:/bin/sh -selene:moon:1000:1000:User:/home/selene:/bin/sh +root:toor:0:0:Administrator:/:/usr/bin/sh +selene:moon:1000:1000:User:/home/selene:/usr/bin/sh diff --git a/libc/src/unistd.cpp b/libc/src/unistd.cpp index 460bf832..04be50ca 100644 --- a/libc/src/unistd.cpp +++ b/libc/src/unistd.cpp @@ -23,7 +23,7 @@ static Result try_execvpe(const char* name, char* const* argv, char* const* if (strchr(name, '/')) return execve(name, argv, envp); char* path = getenv("PATH"); - if (!path) path = const_cast("/bin:/sbin"); + if (!path) path = const_cast("/usr/bin:/usr/local/bin"); Vector paths = TRY(StringView { path }.split(":"));