Changeset 56 in MondoRescue
- Timestamp:
- Oct 9, 2005, 1:47:23 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/newt-specific.c
r45 r56 262 262 /*@ end vars **************************************************** */ 263 263 264 tmp = malloc(MAX_NEWT_COMMENT_LEN);265 264 set_signals(FALSE); // link to external func 266 265 g_exiting = TRUE; … … 270 269 log_msg(2, "mastermind %d is exiting", (int) getpid()); 271 270 kill(g_main_pid, SIGTERM); 272 paranoid_free(tmp);273 271 finish(1); 274 272 } … … 278 276 log_msg(2, "non-m/m %d is exiting", (int) getpid()); 279 277 kill(g_main_pid, SIGTERM); 280 paranoid_free(tmp);281 278 finish(1); 282 279 } … … 286 283 if (already_exiting) { 287 284 log_msg(3, "...I'm already exiting. Give me time, Julian!"); 288 paranoid_free(tmp);289 285 finish(1); 290 286 } … … 297 293 kill_anything_like_this("partimagehack"); 298 294 sync(); 299 sprintf(tmp, "umount %s", g_tmpfs_mountpt);295 asprintf(&tmp, "umount %s", g_tmpfs_mountpt); 300 296 chdir("/"); 301 297 for (i = 0; i < 10 && run_program_and_log_output(tmp, 5); i++) { … … 304 300 run_program_and_log_output(tmp, 5); 305 301 } 302 paranoid_free(tmp); 306 303 307 304 if (g_erase_tmpdir_and_scratchdir[0]) { … … 349 346 log_msg(3, "FYI - g_main_pid is blank"); 350 347 } 351 paranoid_free(tmp);352 348 finish(254); 353 349 } … … 419 415 int i = 0; 420 416 421 malloc_string(command);422 malloc_string(tmp);423 417 assert_string_is_neither_NULL_nor_zerolength(filename); 424 418 assert(grep_for_me != NULL); 425 419 426 420 if (!does_file_exist(filename)) { 427 paranoid_free(command);428 paranoid_free(tmp);429 421 return; 430 422 } 431 423 if (grep_for_me[0] != '\0') { 432 sprintf(command, "cat %s | grep \"%s\" | tail -n%d", filename,424 asprintf(&command, "cat %s | grep \"%s\" | tail -n%d", filename, 433 425 grep_for_me, g_noof_log_lines); 434 426 } else { 435 sprintf(command, "cat %s | tail -n%d", filename,427 asprintf(&command, "cat %s | tail -n%d", filename, 436 428 g_noof_log_lines); 437 429 } … … 447 439 strip_spaces(err_log_lines[i]); 448 440 if (!strncmp(err_log_lines[i], "root:", 5)) { 449 strcpy(tmp, err_log_lines[i] + 6);441 asprintf(&tmp, "%s", err_log_lines[i] + 6); 450 442 strcpy(err_log_lines[i], tmp); 443 paranoid_free(tmp); 451 444 } 452 445 if (feof(fin)) { … … 459 452 refresh_log_screen(); 460 453 paranoid_free(command); 461 paranoid_free(tmp);462 454 } 463 455 … … 479 471 char *output; 480 472 481 malloc_string(output);482 473 483 474 va_start(args, fmt); 484 v sprintf(output, fmt, args);475 vasprintf(&output, fmt, args); 485 476 log_msg(0, output); 486 output[80] = '\0'; 477 if (strlen(output > 80)) { 478 output[80] = '\0'; 479 } 487 480 va_end(args); 488 481 i = (int) strlen(output);
Note:
See TracChangeset
for help on using the changeset viewer.