- Timestamp:
- May 15, 2009, 4:56:31 AM (16 years ago)
- Location:
- branches/2.2.9/mondo
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mondo/configure.in
r2202 r2209 125 125 AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo setenv strcasecmp strchr strerror strrchr strstr mkdtemp]) 126 126 127 AC_OUTPUT([Makefile src/Makefile src/ common/Makefile src/mondoarchive/Makefile src/mondorestore/Makefile src/restore-scripts/Makefile src/restore-scripts/mondo/Makefile src/post-nuke.sample/Makefile src/post-nuke.sample/usr/Makefile src/post-nuke.sample/usr/bin/Makefile test/Makefile])127 AC_OUTPUT([Makefile src/Makefile src/lib/Makefile src/common/Makefile src/mondoarchive/Makefile src/mondorestore/Makefile src/restore-scripts/Makefile src/restore-scripts/mondo/Makefile src/post-nuke.sample/Makefile src/post-nuke.sample/usr/Makefile src/post-nuke.sample/usr/bin/Makefile test/Makefile]) -
branches/2.2.9/mondo/src/Makefile.am
r761 r2209 1 SUBDIRS = common mondoarchive mondorestore restore-scripts post-nuke.sample1 SUBDIRS = lib common mondoarchive mondorestore restore-scripts post-nuke.sample 2 2 DIST_SUBDIRS = ${SUBDIRS} 3 3 -
branches/2.2.9/mondo/src/common/libmondo-mountlist.c
r2207 r2209 10 10 11 11 #include "my-stuff.h" 12 #include "mr_ str.h"12 #include "mr_mem.h" 13 13 #include "mondostructures.h" 14 14 #include "libmondo-mountlist.h" … … 62 62 char mountpoint[MAX_STR_LEN]; 63 63 64 char *flaws_str = NULL; 65 64 66 /*@ long *********************************************************** */ 65 67 long physical_drive_size = 0; … … 72 74 prev_part_no = 0; 73 75 tmp[0] = '\0'; 76 asprintf(&flaws_str, "%s", ""); 74 77 75 78 … … 78 81 if (physical_drive_size < 0) { 79 82 sprintf(tmp, " %s does not exist.", drive); 80 asprintf(&flaws_str, "%s", tmp);83 mr_strcat(flaws_str, "%s", tmp); 81 84 } else { 82 85 sprintf(tmp, "%s is %ld MB", drive, physical_drive_size); … … 166 169 if (((pos >= 0) || npos) && foundsome) { 167 170 mr_strcat(flaws_str, " %s has both DD and PC-style partitions.", drive); 168 return ++res; // fatal error171 return(flaws_str); // fatal error 169 172 } 170 173 … … 177 180 sprintf(tmp, " Gap prior to %s.", device); 178 181 log_it(tmp); 179 mr_strcat(flaws_str, tmp);182 mr_strcat(flaws_str, "%s", tmp); 180 183 res++; 181 184 } else if (curr_part_no > 5 … … 184 187 prev_part_no, curr_part_no); 185 188 log_it(tmp); 186 mr_strcat(flaws_str, tmp);189 mr_strcat(flaws_str, "%s", tmp); 187 190 res++; 188 191 } … … 195 198 sprintf(tmp, " Partition %ss4 is occupied.", drive); 196 199 log_it(tmp); 197 mr_strcat(flaws_str, tmp);200 mr_strcat(flaws_str, "%s", tmp); 198 201 res++; 199 202 } … … 208 211 sprintf(tmp, " %s %s's.", number_to_text(device_copies), 209 212 device); 210 if (!strstr(flaws_str, tmp)) {213 if (!strstr(flaws_str, "%s", tmp)) { 211 214 log_it(tmp); 212 mr_strcat(flaws_str, tmp);215 mr_strcat(flaws_str, "%s", tmp); 213 216 res++; 214 217 } … … 219 222 sprintf(tmp, " %s is tiny!", device); 220 223 log_it(tmp); 221 mr_strcat(flaws_str, tmp);224 mr_strcat(flaws_str, "%s", tmp); 222 225 res++; 223 226 } … … 231 234 sprintf(tmp, " %s has a weird mountpoint.", device); 232 235 log_it(tmp); 233 mr_strcat(flaws_str, tmp);236 mr_strcat(flaws_str, "%s", tmp); 234 237 res++; 235 238 } … … 238 241 sprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 239 242 log_it(tmp); 240 mr_strcat(flaws_str, tmp);243 mr_strcat(flaws_str, "%s", tmp); 241 244 res++; 242 245 } … … 254 257 sprintf(tmp, " Can only have up to 'h' in disklabel."); 255 258 log_it(tmp); 256 mr_strcat(flaws_str, tmp);259 mr_strcat(flaws_str, "%s", tmp); 257 260 res++; 258 261 } … … 269 272 if (!strstr(flaws_str, tmp)) { 270 273 log_it(tmp); 271 mr_strcat(flaws_str, tmp);274 mr_strcat(flaws_str, "%s", tmp); 272 275 res++; 273 276 } … … 278 281 sprintf(tmp, " %s is tiny!", device); 279 282 log_it(tmp); 280 mr_strcat(flaws_str, tmp);283 mr_strcat(flaws_str, "%s", tmp); 281 284 res++; 282 285 } … … 290 293 sprintf(tmp, " %s has a weird mountpoint.", device); 291 294 log_it(tmp); 292 mr_strcat(flaws_str, tmp);295 mr_strcat(flaws_str, "%s", tmp); 293 296 res++; 294 297 } … … 298 301 sprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 299 302 log_it(tmp); 300 mr_strcat(flaws_str, tmp);303 mr_strcat(flaws_str, "%s", tmp); 301 304 res++; 302 305 } … … 317 320 amount_allocated - physical_drive_size, drive); 318 321 log_it(tmp); 319 mr_strcat(flaws_str, tmp);322 mr_strcat(flaws_str, "%s", tmp); 320 323 res++; 321 324 } else if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ … … 323 326 physical_drive_size - amount_allocated, drive); 324 327 log_it(tmp); 325 mr_strcat(flaws_str, tmp);328 mr_strcat(flaws_str, "%s", tmp); 326 329 } 327 330 if (res) { 328 return ( FALSE);331 return (NULL); 329 332 } else { 330 return ( TRUE);333 return (flaws_str); 331 334 } 332 335 } … … 348 351 char *tmp; 349 352 char *device; 353 char *flaws_str = NULL; 350 354 351 355 /*@ long *********************************************************** */ … … 359 363 assert_string_is_neither_NULL_nor_zerolength(drive); 360 364 assert(mountlist != NULL); 361 as sert(flaws_str != NULL);365 asprintf(&flaws_str, "%s", ""); 362 366 363 367 malloc_string(tmp); 364 368 malloc_string(device); 365 flaws_str[0] = '\0';366 369 prev_part_no = 0; 367 370 tmp[0] = '\0'; … … 372 375 if (physical_drive_size < 0) { 373 376 sprintf(tmp, " %s does not exist.", drive); 374 strcat(flaws_str, tmp);377 mr_strcat(flaws_str, "%s", tmp); 375 378 res++; 376 379 log_msg(1, tmp); … … 392 395 sprintf(tmp, " Gap prior to %s.", device); 393 396 log_it(tmp); 394 strcat(flaws_str, tmp);397 mr_strcat(flaws_str, "%s", tmp); 395 398 res++; 396 399 } else if (curr_part_no > 5 … … 399 402 prev_part_no, curr_part_no); 400 403 log_it(tmp); 401 strcat(flaws_str, tmp);404 mr_strcat(flaws_str, "%s", tmp); 402 405 res++; 403 406 } … … 410 413 sprintf(tmp, " Partition 4 of %s is occupied.", drive); 411 414 log_it(tmp); 412 strcat(flaws_str, tmp);415 mr_strcat(flaws_str, "%s", tmp); 413 416 res++; 414 417 } … … 425 428 if (!strstr(flaws_str, tmp)) { 426 429 log_it(tmp); 427 strcat(flaws_str, tmp);430 mr_strcat(flaws_str, "%s", tmp); 428 431 res++; 429 432 } … … 434 437 sprintf(tmp, " %s is tiny!", device); 435 438 log_it(tmp); 436 strcat(flaws_str, tmp);439 mr_strcat(flaws_str, "%s", tmp); 437 440 res++; 438 441 } … … 445 448 sprintf(tmp, " %s has a weird mountpoint.", device); 446 449 log_it(tmp); 447 strcat(flaws_str, tmp);450 mr_strcat(flaws_str, "%s", tmp); 448 451 res++; 449 452 } … … 452 455 sprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 453 456 log_it(tmp); 454 strcat(flaws_str, tmp);457 mr_strcat(flaws_str, "%s", tmp); 455 458 res++; 456 459 } … … 465 468 amount_allocated - physical_drive_size, drive); 466 469 log_it(tmp); 467 strcat(flaws_str, tmp);470 mr_strcat(flaws_str, "%s", tmp); 468 471 res++; 469 472 } else if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ … … 471 474 physical_drive_size - amount_allocated, drive); 472 475 log_it(tmp); 473 strcat(flaws_str, tmp);476 mr_strcat(flaws_str, "%s", tmp); 474 477 } 475 478 … … 479 482 480 483 if (res) { 481 return ( FALSE);484 return (NULL); 482 485 } else { 483 return ( TRUE);486 return (flaws_str); 484 487 } 485 488 } … … 514 517 515 518 drivelist = malloc(sizeof(struct list_of_disks)); 516 malloc_string(flaws_str);517 519 assert(mountlist != NULL); 518 520 assert(flaws_str_A != NULL); 519 521 assert(flaws_str_B != NULL); 520 522 assert(flaws_str_C != NULL); 521 flaws_str[0] = '\0'; 523 524 asprintf(&flaws_str, "%s", ""); 522 525 523 526 make_list_of_drives_in_mountlist(mountlist, drivelist); … … 540 543 log_msg(8,"Entry: %d (%s)", i, drivelist->el[i].device); 541 544 log_msg(8,"Adding: %s to %s", tmp, flaws_str); 542 strncat(flaws_str, tmp, MAX_STR_LEN -1);545 mr_strcat(flaws_str, "%s", tmp); 543 546 paranoid_free(tmp); 544 547 } 545 548 res += look_for_duplicate_mountpoints(mountlist, flaws_str); 546 return (spread_flaws_across_three_lines 547 (flaws_str, flaws_str_A, flaws_str_B, flaws_str_C, res)); 549 res = spread_flaws_across_three_lines(flaws_str, flaws_str_A, flaws_str_B, flaws_str_C,res); 550 paranoid_free(flaws_str); 551 return(res); 548 552 } 549 553 … … 584 588 */ 585 589 int 586 look_for_duplicate_mountpoints(struct mountlist_itself *mountlist, 587 char *flaws_str) 590 look_for_duplicate_mountpoints(struct mountlist_itself *mountlist, char *flaws_str) 588 591 { 589 592 … … 617 620 asprintf(&tmp, " %s %s's.", number_to_text(copies), 618 621 curr_mountpoint); 619 strcat(flaws_str, tmp);622 mr_strcat(flaws_str, "%s", tmp); 620 623 log_it(tmp); 621 624 paranoid_free(tmp); -
branches/2.2.9/mondo/src/common/libmondo-string.c
r2190 r2209 625 625 assert(flaws_str != NULL); 626 626 627 flaws_str_A[0] = flaws_str_B[0] = flaws_str_C[0] = '\0';628 629 630 627 if (!res && !strlen(flaws_str)) { 631 628 return (TRUE); 632 629 } 633 630 if (strlen(flaws_str) > 0) { 634 sprintf(flaws_str_A, "%s", flaws_str + 1); 631 paranoid_free(flaws_str_A); 632 asprintf(&flaws_str_A, "%s", flaws_str + 1); 635 633 } 636 634 if (strlen(flaws_str_A) >= 74) { 637 635 for (i = 74; flaws_str_A[i] != ' '; i--); 638 strcpy(flaws_str_B, flaws_str_A + i + 1); 636 paranoid_free(flaws_str_B); 637 asprintf(&flaws_str_B, "%s", flaws_str_A + i + 1); 639 638 flaws_str_A[i] = '\0'; 640 639 } 641 640 if (strlen(flaws_str_B) >= 74) { 642 641 for (i = 74; flaws_str_B[i] != ' '; i--); 643 strcpy(flaws_str_C, flaws_str_B + i + 1); 642 paranoid_free(flaws_str_C); 643 asprintf(&flaws_str_C, "%s", flaws_str_B + i + 1); 644 644 flaws_str_B[i] = '\0'; 645 645 } -
branches/2.2.9/mondo/src/lib/mr_msg.c
r1226 r2209 43 43 int res = 0; 44 44 45 asprintf(&mr_logfile,logfile); 45 if (asprintf(&mr_logfile, "%s", logfile) == -1) { 46 fprintf(stderr,"Unable to alloc memory\n"); 47 fprintf(stderr,"Logging desactivated\n"); 48 mr_msg_close(); 49 } 46 50 if ((fout = fopen(mr_logfile, "w")) == NULL) { 47 51 fprintf(stderr,"Unable to write to %s\n",mr_logfile); -
branches/2.2.9/mondo/src/mondorestore/Makefile.am
r1930 r2209 15 15 mondorestore_SOURCES = mondo-prep.c mondorestore.c mondo-rstr-newt.c \ 16 16 mondo-rstr-compare.c mondo-rstr-tools.c 17 mondorestore_LDADD = ${top_builddir}/src/common/libmondo.a @MONDORESTORE_STATIC@17 mondorestore_LDADD = ${top_builddir}/src/common/libmondo.a ${top_builddir}/src/lib/libmr.a @MONDORESTORE_STATIC@ -
branches/2.2.9/mondo/src/mondorestore/mondo-rstr-newt.c
r2140 r2209 1943 1943 /** buffers **********************************************************/ 1944 1944 char tmp[MAX_STR_LEN]; 1945 char flaws_str_A[MAX_STR_LEN];1946 char flaws_str_B[MAX_STR_LEN];1947 char flaws_str_C[MAX_STR_LEN];1945 char *flaws_str_A = NULL; 1946 char *flaws_str_B = NULL; 1947 char *flaws_str_C = NULL; 1948 1948 1949 1949 assert(mountlist != NULL); 1950 1950 assert(raidlist != NULL); 1951 1951 1952 strcpy(flaws_str_A, "xxxxxxxxx");1953 strcpy(flaws_str_B, "xxxxxxxxx");1954 strcpy(flaws_str_C, "xxxxxxxxx");1952 asprintf(&flaws_str_A, "%s", "xxxxxxxxx"); 1953 asprintf(&flaws_str_B, "%s", "xxxxxxxxx"); 1954 asprintf(&flaws_str_C, "%s", "xxxxxxxxx"); 1955 1955 if (mountlist->entries > ARBITRARY_MAXIMUM) { 1956 1956 log_to_screen("Arbitrary limits suck, man!"); … … 2043 2043 } 2044 2044 } 2045 paranoid_free(flaws_str_A); 2046 paranoid_free(flaws_str_B); 2047 paranoid_free(flaws_str_C); 2045 2048 newtFormDestroy(myForm); 2046 2049 newtPopWindow(); … … 2068 2071 { 2069 2072 int res = 0; 2070 // char tmp[MAX_STR_LEN];2071 2073 2072 2074 iamhere("entering eml"); -
branches/2.2.9/mondo/src/mondorestore/mondorestore.c
r2202 r2209 23 23 24 24 extern void twenty_seconds_til_yikes(void); 25 26 /* We don't have a cleanup function yet */ 27 void (*mr_cleanup)(void) = NULL; 25 28 26 29 /* Reference to global bkpinfo */ … … 776 779 bool boot_loader_installed = FALSE; 777 780 /** malloc **/ 778 char tmp[MAX_STR_LEN], tmpA[MAX_STR_LEN], tmpB[MAX_STR_LEN], 779 tmpC[MAX_STR_LEN]; 781 char tmp[MAX_STR_LEN]; 782 char *tmpA; 783 char *tmpB; 784 char *tmpC; 780 785 781 786 assert(bkpinfo != NULL); 782 787 assert(mountlist != NULL); 783 788 assert(raidlist != NULL); 789 790 asprintf(&tmpA, "%s", "xxxxxxxxx"); 791 asprintf(&tmpB, "%s", "xxxxxxxxx"); 792 asprintf(&tmpC, "%s", "xxxxxxxxx"); 784 793 785 794 log_msg(2, "nuke_mode --- starting"); -
branches/2.2.9/mondo/test/Makefile.am
r2204 r2209 4 4 sbin_PROGRAMS = mrtest_mountlist 5 5 mrtest_mountlist_SOURCES = test-mountlist.c ${top_builddir}/src/mondorestore/mondo-prep.c ${top_builddir}/src/mondorestore/mondo-rstr-newt.c ${top_builddir}/src/mondorestore/mondo-rstr-tools.c 6 mrtest_mountlist_LDADD = ${top_builddir}/src/common/libmondo.a @MONDORESTORE_STATIC@6 mrtest_mountlist_LDADD = ${top_builddir}/src/common/libmondo.a ${top_builddir}/src/lib/libmr.a @MONDORESTORE_STATIC@ -
branches/2.2.9/mondo/test/test-mountlist.c
r2206 r2209 35 35 36 36 extern char *MONDO_LOGFILE; 37 extern int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived, 38 char direction); 37 extern int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived, char direction); 38 /* We don't have a cleanup function yet */ 39 void (*mr_cleanup)(void) = NULL; 39 40 40 41 void main() {
Note:
See TracChangeset
for help on using the changeset viewer.