mirror of https://github.com/ventoy/Ventoy.git
Fix a bug when install Ventoy if the USB already mounted at a path that contains space.
This commit is contained in:
parent
12a284b543
commit
fd0d335eb6
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -164,11 +164,40 @@ end:
|
||||||
return mount;
|
return mount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ventoy_mount_path_escape(char *src, char *dst, int len)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
dst[len - 1] = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < len - 1; i++)
|
||||||
|
{
|
||||||
|
if (src[i] == '\\' && src[i + 1] == '0' && src[i + 2] == '4' && src[i + 3] == '0')
|
||||||
|
{
|
||||||
|
dst[n++] = ' ';
|
||||||
|
i += 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dst[n++] = src[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (src[i] == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ventoy_try_umount_disk(const char *devpath)
|
int ventoy_try_umount_disk(const char *devpath)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
int len;
|
int len;
|
||||||
char line[512];
|
char line[1024];
|
||||||
|
char mntpt[1024];
|
||||||
char *pos1 = NULL;
|
char *pos1 = NULL;
|
||||||
char *pos2 = NULL;
|
char *pos2 = NULL;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
|
@ -193,14 +222,15 @@ int ventoy_try_umount_disk(const char *devpath)
|
||||||
*pos2 = 0;
|
*pos2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = umount(pos1 + 1);
|
ventoy_mount_path_escape(pos1 + 1, mntpt, sizeof(mntpt));
|
||||||
|
rc = umount(mntpt);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
vdebug("umount %s %s [ failed ] error:%d\n", devpath, pos1 + 1, errno);
|
vdebug("umount <%s> <%s> [ failed ] error:%d\n", devpath, mntpt, errno);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vdebug("umount %s %s [ success ]\n", devpath, pos1 + 1);
|
vdebug("umount <%s> <%s> [ success ]\n", devpath, mntpt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +240,6 @@ int ventoy_try_umount_disk(const char *devpath)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ventoy_read_file_to_buf(const char *FileName, int ExtLen, void **Bufer, int *BufLen)
|
int ventoy_read_file_to_buf(const char *FileName, int ExtLen, void **Bufer, int *BufLen)
|
||||||
{
|
{
|
||||||
int FileSize;
|
int FileSize;
|
||||||
|
|
Loading…
Reference in New Issue