From 4d66f07d59362547af50099de618b85b1d493b7b Mon Sep 17 00:00:00 2001
From: Led <led@altlinux.ru>
Date: Fri, 15 Mar 2013 20:13:28 +0200
Subject: [PATCH] cdrom: primarily try mount first partition of hybrid image

---
 cdrom.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/cdrom.c b/cdrom.c
index d9afb81..02dc1d1 100644
--- a/cdrom.c
+++ b/cdrom.c
@@ -26,6 +26,8 @@
 #include <string.h>
 #include <stdio.h>
 #include <sys/mount.h>
+#include <dirent.h>
+#include <ctype.h>
 #include "stage1.h"
 #include "frontend.h"
 #include "modules.h"
@@ -39,10 +41,19 @@ extern char version[];
 
 static int mount_that_cd_device(char * dev_name)
 {
-	char device_fullname[50];
-
-	strcpy(device_fullname, "/dev/");
-	strcat(device_fullname, dev_name);
+	char device_fullname[64] = "/dev/";
+	size_t l = strlen(strcpy(device_fullname + 5, dev_name));
+
+	if (islower(device_fullname[l - 1])) {
+		int ret;
+
+		device_fullname[l] = '1';
+		device_fullname[l + 1] = '\0';
+		ret = my_mount(device_fullname, IMAGE_LOCATION, "iso9660", 0);
+		if (ret != -1)
+			return ret;
+		device_fullname[l] = '\0';
+	}
 
 	return my_mount(device_fullname, IMAGE_LOCATION, "iso9660", 0);
 }
-- 
1.8.1.5