mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-17 16:44:27 -04:00
[iso] fix handling of label-based ISOs
* Linux has a MAJOR quirk in that labels such as "Contains Space" get converted to "/dev/disk/by-label/Contains\x20Space". * While Rufus already had smart label Syslinux handling (by replacing the ones found in isolinux.cfg to their more limited FAT32 version) there was absolutely NO WAY of guessing this quirk until ISOs such as Red Hat 7 or CentOS 7 started to use spaces in their ISO labels and people reported breakage! * This commit also fixes an issue where psz_fullpath was modified when it shouldn't, which broke Debian 7.7.0, and most likely any ISO containing a subdirectory in the directory where a syslinux/isolinux config file is located. * Closes #396 * Closes #394 * Closes #388 * Closes #380
This commit is contained in:
parent
ed45184aed
commit
55a5eb07e7
4 changed files with 73 additions and 37 deletions
29
src/parser.c
29
src/parser.c
|
@ -1067,3 +1067,32 @@ out:
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Replace all 'c' characters in string 'src' with the subtsring 'rep'
|
||||
* The returned string is allocated and must be freed by the caller.
|
||||
*/
|
||||
char* replace_char(const char* src, const char c, const char* rep)
|
||||
{
|
||||
size_t i, j, k, count=0, str_len = safe_strlen(src), rep_len = safe_strlen(rep);
|
||||
char* res;
|
||||
|
||||
if ((src == NULL) || (rep == NULL))
|
||||
return NULL;
|
||||
for (i=0; i<str_len; i++) {
|
||||
if (src[i] == c)
|
||||
count++;
|
||||
}
|
||||
res = (char*)malloc(str_len + count*rep_len + 1);
|
||||
for (i=0,j=0; i<str_len; i++) {
|
||||
if (src[i] == c) {
|
||||
for(k=0; k<rep_len; k++)
|
||||
res[j++] = rep[k];
|
||||
} else {
|
||||
res[j++] = src[i];
|
||||
}
|
||||
}
|
||||
res[j] = 0;
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue