Changeset 783 in MondoRescue for trunk/mondo/mondo/common/libmondo-fork.c
- Timestamp:
- Aug 31, 2006, 5:09:20 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-fork.c
r689 r783 11 11 #include "libmondo-tools-EXT.h" 12 12 13 extern char *g_tmpfs_mountpt;14 extern t_bkptype g_backup_media_type;15 13 extern bool g_text_mode; 16 14 pid_t g_buffer_pid = 0; … … 107 105 log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'", 108 106 what_i_am_doing); 109 strcpy(tmp, command);110 107 if (bkpinfo->manual_cd_tray) { 111 p = strstr(tmp, "2>>"); 108 /* Find everything after a 2>> and remove it */ 109 p = strstr(command, "2>>"); 112 110 if (p) { 113 sprintf(p, " "); 114 while (*p == ' ') { 115 p++; 116 } 117 for (; *p != ' '; p++) { 111 for (; *p != ' ' && *p != '\0'; p++) { 118 112 *p = ' '; 119 113 } 120 114 } 121 paranoid_free(command);122 asprintf(&command, tmp);123 115 #ifndef _XWIN 124 116 if (!g_text_mode) { … … 164 156 { 165 157 /*@ buffer ****************************************************** */ 166 char *callstr ;158 char *callstr = NULL; 167 159 char *incoming = NULL; 168 char tmp[MAX_STR_LEN * 2];169 160 170 161 /*@ int ********************************************************* */ 171 int res; 172 int i; 162 int res = 0; 173 163 size_t n = 0; 174 int len;175 164 bool log_if_failure = FALSE; 176 165 bool log_if_success = FALSE; … … 203 192 204 193 205 len = (int) strlen(program);206 for (i = 0; i < 35 - len / 2; i++) {207 tmp[i] = '-';208 }209 tmp[i] = '\0';210 strcat(tmp, " ");211 strcat(tmp, program);212 strcat(tmp, " ");213 for (i = 0; i < 35 - len / 2; i++) {214 strcat(tmp, "-");215 }216 194 res = system(callstr); 217 195 if (((res == 0) && log_if_success) || ((res != 0) && log_if_failure)) { … … 361 339 // if dir=='w' then copy from orig to archived 362 340 // if dir=='r' then copy from archived to orig 363 char *tmp ;364 char *buf ;341 char *tmp = NULL; 342 char *buf = NULL; 365 343 long int bytes_to_be_read, bytes_read_in, bytes_written_out = 366 344 0, bufcap, subsliceno = 0; 367 345 int retval = 0; 368 FILE *fin ;369 FILE *fout ;370 FILE *ftmp ;346 FILE *fin = NULL; 347 FILE *fout = NULL; 348 FILE *ftmp = NULL; 371 349 372 350 log_msg(5, "Opening."); … … 439 417 } 440 418 bytes_written_out += fwrite(buf, 1, bytes_read_in, fout); 441 if (fread(tmp, 1, 64 , fin) != 64) {419 if (fread(tmp, 1, 64L, fin) != 64L) { 442 420 fatal_error("Cannot read post-thingy block"); 443 421 } … … 448 426 log_msg(7, "Subslice #%ld read OK", subsliceno); 449 427 subsliceno++; 450 if (fread(tmp, 1, 64 , fin) != 64) {428 if (fread(tmp, 1, 64L, fin) != 64L) { 451 429 fatal_error("Cannot read introductory block"); 452 430 } … … 458 436 459 437 if (direction == 'w') { 438 paranoid_free(tmp); 460 439 asprintf(&tmp, "%-64s", PIMP_END_SZ); 461 if (fwrite(tmp, 1, 64 , fout) != 64) {440 if (fwrite(tmp, 1, 64L, fout) != 64L) { 462 441 fatal_error("Can't write the final block"); 463 442 } … … 466 445 log_msg(1, "tmpA is %s", tmp); 467 446 if (!strstr(tmp, PIMP_END_SZ)) { 468 if (fread(tmp, 1, 64 , fin) != 64) {447 if (fread(tmp, 1, 64L, fin) != 64L) { 469 448 fatal_error("Can't read the final block"); 470 449 } … … 472 451 if (!strstr(tmp, PIMP_END_SZ)) { 473 452 ftmp = fopen("/tmp/out.leftover", "w"); 474 bytes_read_in = fread(tmp, 1, 64 , fin);453 bytes_read_in = fread(tmp, 1, 64L, fin); 475 454 log_msg(1, "bytes_read_in = %ld", bytes_read_in); 476 455 // if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); } 477 456 fwrite(tmp, 1, bytes_read_in, ftmp); 457 478 458 paranoid_free(tmp); 479 480 459 if (!(tmp = malloc(512))) { 481 460 fatal_error("Failed to malloc() tmp"); 482 461 } 483 462 /* BERLIOS : strange ??? 484 s printf(tmp, "I am here - %llu", ftello(fin));485 log_msg(0, tmp);486 */463 s-printf(tmp, "I am here - %llu", ftello(fin)); 464 log_msg(0, tmp); 465 */ 487 466 fread(tmp, 1, 512, fin); 488 467 log_msg(0, "tmp = '%s'", tmp); … … 571 550 if (pcno <= 5 && last_pcno > 40) { 572 551 close_evalcall_form(); 573 open_evalcall_form("_(Verifying...") );552 open_evalcall_form("_(Verifying..."); 574 553 } 575 554 last_pcno = pcno;
Note:
See TracChangeset
for help on using the changeset viewer.