Ticket #4602: dosfs_volume_name2.diff
File dosfs_volume_name2.diff, 1.9 KB (added by , 15 years ago) |
---|
-
util.c
164 164 c = (c << 7) + (c >> 1) + *(p++); 165 165 return c; 166 166 } 167 168 169 void sanatize_name(char *name, int length) 170 { 171 int i; 172 173 // XXX: should sanitize name as well 174 for (i = length - 1; i > 0; i--) 175 if (name[i] != ' ') 176 break; 177 name[i + 1] = 0; 178 for (; i >= 0; i--) { 179 if ((name[i] >= 'A') && (name[i] <= 'Z')) 180 name[i] += 'a' - 'A'; 181 } 182 183 } -
dosfs.c
765 765 766 766 cookie->bytes_per_sector = bytes_per_sector; 767 767 cookie->total_sectors = total_sectors; 768 sanatize_name(name, 12); 768 769 strlcpy(cookie->name, name, 12); 769 770 *_cookie = cookie; 770 771 … … 994 995 dosfs_read_fs_stat(fs_volume *_vol, struct fs_info * fss) 995 996 { 996 997 nspace* vol = (nspace*)_vol->private_volume; 997 int i;998 998 999 999 LOCK_VOL(vol); 1000 1000 … … 1021 1021 strncpy(fss->device_name, vol->device, sizeof(fss->device_name)); 1022 1022 1023 1023 if (vol->vol_entry > -2) 1024 str ncpy(fss->volume_name, vol->vol_label, sizeof(fss->volume_name));1024 strlcpy(fss->volume_name, vol->vol_label, sizeof(fss->volume_name)); 1025 1025 else 1026 1026 strcpy(fss->volume_name, "no name"); 1027 1027 1028 // XXX: should sanitize name as well 1029 for (i=10;i>0;i--) 1030 if (fss->volume_name[i] != ' ') 1031 break; 1032 fss->volume_name[i+1] = 0; 1033 for (;i>=0;i--) { 1034 if ((fss->volume_name[i] >= 'A') && (fss->volume_name[i] <= 'Z')) 1035 fss->volume_name[i] += 'a' - 'A'; 1036 } 1028 sanatize_name(fss->volume_name, 11); 1037 1029 1038 1030 // File system name 1039 1031 strcpy(fss->fsh_name, "fat"); -
util.h
25 25 uint32 time_t2dos(time_t s); 26 26 27 27 uint8 hash_msdos_name(const char *name); 28 void sanatize_name(char *name, int length); 28 29 29 30 #if 0 30 31 #define read32(buffer,off) \