diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-01-27 21:24:53 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-01-27 21:40:05 +0100 |
commit | b91167f638570405bbd4b8f3d4f73cfba2c738bf (patch) | |
tree | ffdb3dc4d07ef997676db06edb2697e4e66bda40 | |
parent | fc84aa3954b68a36740f78c3fed89e22db93354a (diff) | |
download | rvnit-b91167f638570405bbd4b8f3d4f73cfba2c738bf.tar.gz rvnit-b91167f638570405bbd4b8f3d4f73cfba2c738bf.tar.xz rvnit-b91167f638570405bbd4b8f3d4f73cfba2c738bf.zip |
linux: mount /dev if /dev/null is not found
-rw-r--r-- | rvnit.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/rvnit.c b/rvnit.c index 268013a..816b6f9 100644 --- a/rvnit.c +++ b/rvnit.c @@ -647,12 +647,14 @@ mounted(const char *dir) void init_mount() { #ifdef __linux__ - LOG("init_mount"); + if (!access("/dev/null", F_OK) && !mounted("/dev")) { + LOG("mounting /dev"); + mount("dev", "/dev", "devtmpfs", MS_NOSUID, "mode=0755"); + } if (!mounted("/run")) { LOG("mounting /run"); mount("run", "/run", "tmpfs", MS_NOSUID|MS_NODEV, "mode=0755"); } - LOG("init_mount done"); #endif } @@ -702,7 +704,7 @@ main(int argc, char *argv[]) #endif } - nullfd = open("/dev/nullz", O_RDONLY | O_CLOEXEC); + nullfd = open("/dev/null", O_RDONLY | O_CLOEXEC); if (nullfd < 0) { perror("rvnit: open /dev/null"); |