Changeset 2700 in MondoRescue for branches/2.2.9/mondo/src/common/newt-specific.c
- Timestamp:
- Jan 27, 2011, 7:31:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mondo/src/common/newt-specific.c
r2697 r2700 471 471 472 472 /*@ buffers ********************************************************** */ 473 char *command ;474 char *tmp ;473 char *command = NULL; 474 char *tmp = NULL; 475 475 476 476 /*@ pointers ********************************************************* */ … … 480 480 int i = 0; 481 481 482 malloc_string(command);483 malloc_string(tmp);484 482 assert_string_is_neither_NULL_nor_zerolength(filename); 485 483 assert(grep_for_me != NULL); 486 484 487 485 if (!does_file_exist(filename)) { 488 paranoid_free(command);489 paranoid_free(tmp);490 486 return; 491 487 } 492 488 if (grep_for_me[0] != '\0') { 493 sprintf(command, "grep '%s' %s | tail -n%d",489 mr_asprintf(&command, "grep '%s' %s | tail -n%d", 494 490 grep_for_me, filename, g_noof_log_lines); 495 491 } else { 496 sprintf(command, "tail -n%d %s", g_noof_log_lines,492 mr_asprintf(&command, "tail -n%d %s", g_noof_log_lines, 497 493 filename); 498 494 } … … 510 506 */ 511 507 if (!strncmp(err_log_lines[i], "root:", 5)) { 512 strcpy(tmp, err_log_lines[i] + 6); 513 strcpy(err_log_lines[i], tmp); 508 mr_asprintf(&tmp, "%s", err_log_lines[i] + 6); 509 strncpy(err_log_lines[i], tmp, (size_t)MAX_NEWT_COMMENT_LEN); 510 mr_free(tmp); 514 511 } 515 512 if (feof(fin)) { … … 520 517 paranoid_pclose(fin); 521 518 } 519 mr_free(command); 522 520 refresh_log_screen(); 523 paranoid_free(command);524 paranoid_free(tmp);525 521 } 526 522 … … 545 541 546 542 va_start(args, fmt); 547 vs printf(output, fmt, args);543 vsnprintf(output, MAX_STR_LEN-1, fmt, args); 548 544 log_msg(0, output); 549 545 output[80] = '\0';
Note:
See TracChangeset
for help on using the changeset viewer.