Changeset 2316 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-mountlist.c
- Timestamp:
- Aug 18, 2009, 2:34:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-mountlist.c
r2306 r2316 59 59 /*@ buffers ******************************************************** */ 60 60 char tmp = NULL; 61 char device[MAX_STR_LEN];61 char *device = NULL; 62 62 char mountpoint[MAX_STR_LEN]; 63 63 … … 90 90 /* check DD */ 91 91 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 92 sprintf(device, "%s%c", drive, cur_sp_no);93 if (find_device_in_mountlist(mountlist, device) >= 0) 92 mr_asprintf(&device, "%s%c", drive, cur_sp_no); 93 if (find_device_in_mountlist(mountlist, device) >= 0) { 94 94 foundsome = TRUE; 95 } 96 mr_free(device); 95 97 } 96 98 if (foundsome) { 97 99 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 98 sprintf(device, "%s%c", drive, cur_sp_no);100 mr_asprintf(&device, "%s%c", drive, cur_sp_no); 99 101 pos = find_device_in_mountlist(mountlist, device); 100 102 if (pos < 0) { 103 mr_free(device); 101 104 continue; 102 105 } … … 156 159 res++; 157 160 } 161 mr_free(device); 162 158 163 amount_allocated += mountlist->el[pos].size / 1024L; 159 164 prev_sp_no = cur_sp_no; … … 163 168 npos = pos = 0; 164 169 for (curr_part_no = 1; curr_part_no < 99; curr_part_no++) { 165 build_partition_name(device,drive, curr_part_no);170 device = build_partition_name(drive, curr_part_no); 166 171 pos = find_device_in_mountlist(mountlist, device); 167 172 npos = 0; 168 173 for (cur_sp_no = 'a'; cur_sp_no <= 'h'; cur_sp_no++) { 169 sprintf(device, "%ss%i%c", device, curr_part_no, cur_sp_no);170 if (find_device_in_mountlist(mountlist, device) >= 0)174 mr_asprintf(&tmp, "%ss%i%c", device, curr_part_no, cur_sp_no); 175 if (find_device_in_mountlist(mountlist, tmp) >= 0) { 171 176 npos++; 172 } 177 } 178 mr_free(tmp); 179 } 180 mr_free(device); 181 173 182 if (((pos >= 0) || npos) && foundsome) { 174 183 mr_strcat(flaws_str, " %s has both DD and PC-style partitions.", drive); … … 176 185 } 177 186 178 build_partition_name(device,drive, curr_part_no);187 device = build_partition_name(drive, curr_part_no); 179 188 strcpy(mountpoint, mountlist->el[pos].mountpoint); 180 189 if (pos > 0 && !npos) { … … 256 265 /* Check subpartitions */ 257 266 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 258 sprintf(device, "%ss%d%c", drive, curr_part_no, cur_sp_no); 267 mr_free(device); 268 mr_asprintf(device, "%ss%d%c", drive, curr_part_no, cur_sp_no); 259 269 pos = find_device_in_mountlist(mountlist, device); 260 270 if (pos < 0) { … … 321 331 } 322 332 } 333 mr_free(device); 323 334 324 335 /* OK, continue with main loop */ … … 380 391 mr_asprintf(&flaws_str, "%s", ""); 381 392 382 malloc_string(device);383 393 prev_part_no = 0; 384 394 … … 391 401 log_msg(1, tmp); 392 402 mr_free(tmp); 393 goto endoffunc;403 return(flaws_str); 394 404 } else { 395 405 mr_asprintf(&tmp, "%s is %ld MB", drive, physical_drive_size); … … 399 409 400 410 for (curr_part_no = 1; curr_part_no < 99; curr_part_no++) { 401 build_partition_name(device,drive, curr_part_no);411 device = build_partition_name(drive, curr_part_no); 402 412 pos = find_device_in_mountlist(mountlist, device); 403 413 if (pos < 0) { … … 441 451 } 442 452 if (device_copies > 1) { 443 mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), 444 device); 453 mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device); 445 454 if (!strstr(flaws_str, tmp)) { 446 455 log_it(tmp); … … 482 491 amount_allocated += mountlist->el[pos].size / 1024L; 483 492 prev_part_no = curr_part_no; 493 mr_free(device); 484 494 } 485 495 … … 499 509 mr_free(tmp); 500 510 } 501 502 endoffunc:503 paranoid_free(device);504 511 505 512 if (res) {
Note:
See TracChangeset
for help on using the changeset viewer.