From d537f12b889835df055a2053e37686b77545834d Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Wed, 19 Jan 2011 15:01:20 +0000 Subject: backport more stuff from 2010.1 --- mdk-stage1/probing.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'mdk-stage1/probing.c') 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); } -- cgit v1.2.1