wok-current diff syslinux/stuff/extra/iso9660.u @ rev 23831
syslinux/iso2exe: fix loram case
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun May 31 14:59:28 2020 +0000 (2020-05-31) |
parents | 3f48e3a93cd7 |
children |
line diff
1.1 --- a/syslinux/stuff/extra/iso9660.u Mon Dec 31 11:41:25 2012 +0100 1.2 +++ b/syslinux/stuff/extra/iso9660.u Sun May 31 14:59:28 2020 +0000 1.3 @@ -1,24 +1,41 @@ 1.4 --- core/fs/iso9660/iso9660.c 1.5 +++ core/fs/iso9660/iso9660.c 1.6 -@@ -132,6 +132,28 @@ 1.7 +@@ -89,6 +89,24 @@ 1.8 + return true; 1.9 + } 1.10 + 1.11 ++#define __ROCKRIDGE 1.12 ++#ifdef __ROCKRIDGE 1.13 ++static size_t rockname(const struct iso_dir_entry *de, char **name) 1.14 ++{ 1.15 ++ size_t len, delen, n = (de->name_len + 34) & -2; 1.16 ++ char *data = (char *) de; 1.17 ++ 1.18 ++ for (delen = 0; n + 2 < de->length; n += len) { 1.19 ++ len = data[n + 2]; 1.20 ++ if (* (short *) (data + n) == 0x4D4E) { /* NM */ 1.21 ++ *name = data + n + 5; 1.22 ++ delen = len - 5; 1.23 ++ } 1.24 ++ } 1.25 ++ return delen; 1.26 ++} 1.27 ++#endif 1.28 ++ 1.29 + /* 1.30 + * Find a entry in the specified dir with name _dname_. 1.31 + */ 1.32 +@@ -132,6 +150,20 @@ 1.33 1.34 de_name_len = de->name_len; 1.35 de_name = de->name; 1.36 -+#define __ROCKRIDGE 1.37 +#ifdef __ROCKRIDGE 1.38 + { 1.39 -+ char *name = NULL, *end; 1.40 -+ int n = (offset - de_len + de->name_len + 34) & -2; 1.41 -+ int len = data[n + 2]; 1.42 -+ do { 1.43 -+ if (* (short *) (data + n) == 0x4D4E) { // NM 1.44 -+ name = data + n + 5; 1.45 -+ end = data + n + len; 1.46 -+ } 1.47 -+ n += len; 1.48 -+ } while (n + 2 < offset); 1.49 -+ if (name) { 1.50 -+ *end = 0; 1.51 ++ char *name; 1.52 ++ size_t len = rockname(de, &name); 1.53 ++ 1.54 ++ if (len) { 1.55 ++ name[len] = 0; 1.56 + if (!strcmp(name, dname)) { 1.57 + dprintf("Found rockridge.\n"); 1.58 + return de; 1.59 @@ -29,28 +46,29 @@ 1.60 if (iso_compare_name(de_name, de_name_len, dname)) { 1.61 dprintf("Found.\n"); 1.62 return de; 1.63 -@@ -211,6 +233,24 @@ 1.64 - data = NULL; 1.65 - continue; 1.66 - } 1.67 -+#ifdef __ROCKRIDGE2 1.68 +@@ -217,11 +249,22 @@ 1.69 + dirent->d_ino = 0; /* Inode number is invalid to ISO fs */ 1.70 + dirent->d_off = file->offset; 1.71 + dirent->d_type = get_inode_mode(de->flags); 1.72 +- dirent->d_reclen = offsetof(struct dirent, d_name) + 1 + 1.73 +- iso_convert_name(dirent->d_name, de->name, de->name_len); 1.74 ++ iso_convert_name(dirent->d_name, de->name, de->name_len); 1.75 + 1.76 ++#ifdef __ROCKRIDGE 1.77 + { 1.78 -+ char *name = NULL; 1.79 -+ int n = (offset + de->name_len + 34) & -2; 1.80 -+ int len = data[n + 2], delen; 1.81 -+ do { 1.82 -+ if (* (short *) (data + n) == 0x4D4E) { // NM 1.83 -+ name = data + n + 5; 1.84 -+ delen = len - 5; 1.85 -+ } 1.86 -+ n += len; 1.87 -+ } while (n + 2 < offset + de->length); 1.88 -+ if (name) { 1.89 -+ de->name_len = delen; 1.90 -+ strcpy(de->name, name, delen); 1.91 ++ char *name; 1.92 ++ size_t len = rockname(de, &name); 1.93 ++ 1.94 ++ if (len) { 1.95 ++ strcpy(dirent->d_name, name); 1.96 ++ dirent->d_name[len] = 0; 1.97 + } 1.98 + } 1.99 +#endif 1.100 - break; 1.101 - } 1.102 - 1.103 ++ dirent->d_reclen = offsetof(struct dirent, d_name) + 1 + strlen(dirent->d_name); 1.104 + file->offset += de->length; /* Update for next reading */ 1.105 +- 1.106 ++ 1.107 + return 0; 1.108 + } 1.109 +