Commit 2440482b authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

zdtm: create devices with proper major and minor numbers

Currently numbers for /dev/net/tun and /dev/rtc are hardcoded and
they changed after the last kernel update.

Reported-by: Mr Jenkins
Signed-off-by: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4aaa7072
...@@ -342,6 +342,7 @@ int ns_init(int argc, char **argv) ...@@ -342,6 +342,7 @@ int ns_init(int argc, char **argv)
static int construct_root() static int construct_root()
{ {
struct stat st;
char *root; char *root;
int dfd; int dfd;
...@@ -366,9 +367,17 @@ static int construct_root() ...@@ -366,9 +367,17 @@ static int construct_root()
mknod("dev/null", 0777 | S_IFCHR, makedev(1, 3)); mknod("dev/null", 0777 | S_IFCHR, makedev(1, 3));
chmod("dev/null", 0777); chmod("dev/null", 0777);
mkdir("dev/net", 0777); mkdir("dev/net", 0777);
mknod("dev/net/tun", 0777 | S_IFCHR, makedev(10, 200)); if (stat("/dev/net/tun", &st)) {
fprintf(stderr, "Unable to stat /dev/net/tun: %m");
return -1;
}
mknod("dev/net/tun", 0777 | S_IFCHR, st.st_rdev);
chmod("dev/net/tun", 0777); chmod("dev/net/tun", 0777);
mknod("dev/rtc", 0777 | S_IFCHR, makedev(254, 0)); if (stat("/dev/rtc", &st)) {
fprintf(stderr, "Unable to stat /dev/rtc: %m");
return -1;
}
mknod("dev/rtc", 0777 | S_IFCHR, st.st_rdev);
chmod("dev/rtc", 0777); chmod("dev/rtc", 0777);
if (fchdir(dfd)) { if (fchdir(dfd)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment