summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/probing.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/probing.c')
-rw-r--r--mdk-stage1/probing.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c
index fd0f39c50..0db75ffbd 100644
--- a/mdk-stage1/probing.c
+++ b/mdk-stage1/probing.c
@@ -1,7 +1,7 @@
/*
- * Guillaume Cottenceau (gc@mandrakesoft.com)
+ * Guillaume Cottenceau (gc@mandriva.com)
*
- * Copyright 2000 Mandrakesoft
+ * Copyright 2000 Mandriva
*
* This software may be freely redistributed under the terms of the GNU
* public license.
@@ -768,10 +768,23 @@ void find_media(enum media_bus bus)
while (fgets(buf, sizeof(buf), f)) {
char name[100];
int major, minor, blocks;
+ struct stat statbuf;
+ char *ptr;
memset(name, 0, sizeof(name));
- sscanf(buf, " %d %d %d %s", &major, &minor, &blocks, name);
- if (streq(name, tmp_name) && tmp[count].type == DISK && ((blocks == 1048575) || (blocks == 1440)))
+ strcpy(name, "/dev/");
+ sscanf(buf, " %d %d %d %s", &major, &minor, &blocks, &name[5]);
+ if (streq(&name[5], tmp_name) && tmp[count].type == DISK && ((blocks == 1048575) || (blocks == 1440)))
tmp[count].type = FLOPPY;
+ /* Try to create all devices while we have major/minor */
+ if ((ptr = strchr(&name[5], '/'))) {
+ *ptr = '\0';
+ if (stat(name, &statbuf))
+ mkdir(name, 0755);
+ *ptr = '/';
+ }
+ if (stat(name, &statbuf) && mknod(name, S_IFBLK | 0600, makedev(major, minor))) {
+ log_perror(name);
+ }
}
fclose(f);
}