Changeset 2383 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-cli.c
- Timestamp:
- Sep 10, 2009, 2:55:51 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2382 r2383 264 264 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l"); 265 265 log_msg(5, "Running: %s", command); 266 m r_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));266 mounted_file_system = call_program_and_get_last_line_of_output(command); 267 267 mr_free(command); 268 268 … … 274 274 mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i); 275 275 log_msg(5, "Running: %s", command); 276 m r_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));276 mounted_file_system = call_program_and_get_last_line_of_output(command); 277 277 mr_free(command); 278 278 … … 333 333 int c = 0; 334 334 int lastpos = 0; 335 char VG[MAX_STR_LEN];335 char *VG = NULL; 336 336 char *tmp = NULL; 337 337 char *command = NULL; … … 358 358 mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf); 359 359 log_msg(5, " Executing: %s", command); 360 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));360 tmp = call_program_and_get_last_line_of_output(command); 361 361 mr_free(command); 362 362 … … 384 384 mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf); 385 385 log_msg(4, "Executing: %s", command); 386 mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command));386 partition_list = call_program_and_get_last_line_of_output(command); 387 387 mr_free(command); 388 388 log_msg(4, "Partition list for %s: %s", dsf, partition_list); … … 438 438 dsf, partitions[i]); 439 439 log_msg(4, " Running: %s", command); 440 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));440 tmp = call_program_and_get_last_line_of_output(command); 441 441 mr_free(command); 442 442 … … 451 451 /* It's not swap. See if we can find the mount point from the mount command. */ 452 452 mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]); 453 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));453 tmp = call_program_and_get_last_line_of_output(command); 454 454 mr_free(command); 455 455 … … 471 471 mr_asprintf(command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]); 472 472 log_msg(4, " Running: %s", command); 473 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));473 tmp = call_program_and_get_last_line_of_output(command); 474 474 mr_free(command); 475 475 if (strlen(tmp)) { … … 480 480 mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]); 481 481 log_msg(4, " Running: %s", command); 482 strcpy(VG, call_program_and_get_last_line_of_output(command));482 VG = call_program_and_get_last_line_of_output(command); 483 483 mr_free(command); 484 484 log_msg(4, " Volume Group: %s", VG); … … 488 488 mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG); 489 489 log_msg(4, " Running: %s", command); 490 m r_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));490 mount_list = call_program_and_get_last_line_of_output(command); 491 491 mr_free(command); 492 492 493 log_msg(4, " VG %s mount_list: %s", VG, mount_list); 493 494 lastpos = 0; … … 498 499 mr_free(tmp); 499 500 mr_free(token); 501 mr_free(VG); 500 502 return (1); 501 503 } … … 510 512 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 511 513 log_msg (5, "Running: %s", command); 512 m r_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));514 mount_list = call_program_and_get_last_line_of_output(command); 513 515 mr_free(command); 514 516 log_msg(4, " Software raid device list: %s", mount_list); … … 518 520 log_msg (5, "Running: %s", command); 519 521 mr_free(tmp); 520 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 522 523 tmp = call_program_and_get_last_line_of_output(command); 521 524 mr_free(command); 525 522 526 log_msg(4, "Number of Software raid device: %s", tmp); 523 527 if (atoi(tmp)) { … … 527 531 mr_free(tmp); 528 532 mr_free(token); 533 mr_free(VG); 529 534 return (1); 530 535 } … … 537 542 log_msg (4, "Error finding Volume Group for partition %s", partitions[i]); 538 543 mr_free(tmp); 544 mr_free(VG); 539 545 return (1); 540 546 } 541 547 mr_free(tmp); 548 mr_free(VG); 542 549 continue; 543 550 } … … 552 559 mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]); 553 560 log_msg(4, " Running: %s", command); 554 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));561 tmp = call_program_and_get_last_line_of_output(command); 555 562 mr_free(command); 556 563 if (!strlen(tmp)) { … … 563 570 mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'"); 564 571 log_msg (5, " Running: %s", command); 565 m r_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));572 mount_list = call_program_and_get_last_line_of_output(command); 566 573 mr_free(command); 567 574 log_msg(4, " Software raid device list: %s", mount_list); … … 572 579 log_msg(4, " Running: %s", command); 573 580 mr_free(tmp); 574 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));581 tmp = call_program_and_get_last_line_of_output(command); 575 582 mr_free(command); 576 583 if (!atoi(tmp)) { … … 1009 1016 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount); 1010 1017 mr_free(bkpinfo->isodir); 1011 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1));1018 bkpinfo->isodir = call_program_and_get_last_line_of_output(tmp1); 1012 1019 mr_free(tmp1); 1013 1020 … … 1027 1034 mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->netfs_mount); 1028 1035 mr_free(bkpinfo->isodir); 1029 mr_asprintf(bkpinfo->isodir, "%s", call_program_and_get_last_line_of_output(tmp1));1036 bkpinfo->isodir = call_program_and_get_last_line_of_output(tmp1); 1030 1037 mr_free(tmp1); 1031 1038
Note:
See TracChangeset
for help on using the changeset viewer.