cdrom.c: fix breaking strlen()
This commit is contained in:
parent
83fd161329
commit
13019baef2
20
cdrom.c
20
cdrom.c
@ -39,23 +39,29 @@
|
||||
|
||||
extern char version[];
|
||||
|
||||
static int mount_iso9660(char * dev_name)
|
||||
{
|
||||
return my_mount(dev_name, IMAGE_LOCATION, "iso9660", 0);
|
||||
}
|
||||
|
||||
static int mount_that_cd_device(char * dev_name)
|
||||
{
|
||||
char device_fullname[64] = "/dev/";
|
||||
size_t l = strlen(strcpy(device_fullname + 5, dev_name));
|
||||
char * p = strcpy(device_fullname + 5, dev_name);
|
||||
|
||||
if (islower(device_fullname[l - 1])) {
|
||||
p += strlen(device_fullname);
|
||||
if (islower(p[-1])) {
|
||||
int ret;
|
||||
|
||||
device_fullname[l] = '1';
|
||||
device_fullname[l + 1] = '\0';
|
||||
ret = my_mount(device_fullname, IMAGE_LOCATION, "iso9660", 0);
|
||||
p[0] = '1';
|
||||
p[1] = '\0';
|
||||
ret = mount_iso9660(device_fullname);
|
||||
if (ret != -1)
|
||||
return ret;
|
||||
device_fullname[l] = '\0';
|
||||
p[0] = '\0';
|
||||
}
|
||||
|
||||
return my_mount(device_fullname, IMAGE_LOCATION, "iso9660", 0);
|
||||
return mount_iso9660(device_fullname);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user