← Commit list

a7e3d0520

Rob Landley
Rob Landley
2006-02-21
SOURCE BUG Duration: 3s

Subject

Create /dev/root symlink pointing to real root device, if any.

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Debian 14.2.0-19) 14.2.0

—

Build Log

(log yok)

Commit Diff GitHub →

util-linux/mdev.c+11 -0
@@ -16,6 +16,7 @@
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
@@ -27,6 +28,8 @@
#include <busybox.h>
+int root_major, root_minor;
+
/* mknod in /dev based on a path like "/sys/block/hda/hda1" */
static void make_device(char *path)
{
@@ -169,6 +172,9 @@ found_device:
if (mknod(temp, mode | type, makedev(major, minor)) && errno != EEXIST)
bb_perror_msg_and_die("mknod %s failed", temp);
+ if (major==root_major && minor==root_minor)
+ symlink(temp,DEV_PATH "/root");
+
if (ENABLE_FEATURE_MDEV_CONF) chown(temp,uid,gid);
end:
@@ -217,6 +223,11 @@ int mdev_main(int argc, char *argv[])
/* Scan */
if (argc == 2 && !strcmp(argv[1],"-s")) {
+ struct stat st;
+
+ stat("/", &st); // If this fails, we have bigger problems.
+ root_major=major(st.st_dev);
+ root_minor=minor(st.st_dev);
strcpy(temp,"/sys/block");
find_dev(temp);
strcpy(temp,"/sys/class");