← Commit list

10b36f94b

Rob Landley
Rob Landley
2006-08-10
SOURCE BUG Duration: 35s

Subject

Patch from Chris Steel to fix mdev deleting device nodes.

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 (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

util-linux/mdev.c+9 -7
@@ -37,18 +37,19 @@ static void make_device(char *path, int delete)
* because sscanf() will stop at the first nondigit, which \n is. We
* also depend on path having writeable space after it. */
- strcat(path, "/dev");
- fd = open(path, O_RDONLY);
- len = read(fd, temp + 1, 64);
- *temp++ = 0;
- close(fd);
- if (len < 1) return;
+ if (!delete) {
+ strcat(path, "/dev");
+ fd = open(path, O_RDONLY);
+ len = read(fd, temp + 1, 64);
+ *temp++ = 0;
+ close(fd);
+ if (len < 1) return;
+ }
/* Determine device name, type, major and minor */
device_name = strrchr(path, '/') + 1;
type = path[5]=='c' ? S_IFCHR : S_IFBLK;
- if (sscanf(temp, "%d:%d", &major, &minor) != 2) return;
/* If we have a config file, look up permissions for this device */
@@ -164,6 +165,7 @@ static void make_device(char *path, int delete)
umask(0);
if (!delete) {
+ if (sscanf(temp, "%d:%d", &major, &minor) != 2) return;
if (mknod(device_name, mode | type, makedev(major, minor)) && errno != EEXIST)
bb_perror_msg_and_die("mknod %s failed", device_name);