Browse Source

LibC: Add chroot() stub

Expected behavior left as a FIXME is described here:
https://pubs.opengroup.org/onlinepubs/7908799/xsh/chroot.html

It is marked as LEGACY but still used in projects such as PHP.
Jelle Raaijmakers 3 years ago
parent
commit
a6539cc031
2 changed files with 7 additions and 0 deletions
  1. 6 0
      Userland/Libraries/LibC/unistd.cpp
  2. 1 0
      Userland/Libraries/LibC/unistd.h

+ 6 - 0
Userland/Libraries/LibC/unistd.cpp

@@ -796,4 +796,10 @@ int pause()
 {
     return select(0, nullptr, nullptr, nullptr, nullptr);
 }
+
+int chroot(const char* path)
+{
+    dbgln("FIXME: chroot(\"{}\")", path);
+    return -1;
+}
 }

+ 1 - 0
Userland/Libraries/LibC/unistd.h

@@ -114,6 +114,7 @@ int pledge(const char* promises, const char* execpromises);
 int unveil(const char* path, const char* permissions);
 char* getpass(const char* prompt);
 int pause();
+int chroot(const char*);
 
 enum {
     _PC_NAME_MAX,