Changeset 2334 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-tools.c
- Timestamp:
- Aug 18, 2009, 5:28:18 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2332 r2334 170 170 void clean_up_KDE_desktop_if_necessary(void) 171 171 { 172 char *tmp; 173 174 malloc_string(tmp); 175 strcpy(tmp, 176 "for i in `find /root /home -type d -name Desktop -maxdepth 2`; do \ 177 file=$i/.directory; if [ -f \"$file\" ] ; then mv -f $file $file.old ; \ 178 awk '{if (index($0, \"rootimagesmindi\")) { while (length($0)>2) { getline;} ; } \ 179 else { print $0;};}' $file.old > $file ; fi ; done"); 172 char *tmp = NULL; 173 174 mr_asprintf(tmp, "for i in `find /root /home -type d -name Desktop -maxdepth 2`; do file=$i/.directory; if [ -f \"$file\" ] ; then mv -f $file $file.old ; awk '{if (index($0, \"rootimagesmindi\")) { while (length($0)>2) { getline;} ; } else { print $0;};}' $file.old > $file ; fi ; done"); 180 175 run_program_and_log_output(tmp, 5); 181 paranoid_free(tmp);176 mr_free(tmp); 182 177 } 183 178 … … 227 222 double get_kernel_version(void) 228 223 { 229 char *p, tmp[200]; 224 char *p = NULL; 225 char *tmp = NULL; 230 226 double d; 231 227 #ifdef __FreeBSD__ … … 233 229 d = 5.2; // :-) 234 230 #else 235 strcpy(tmp, call_program_and_get_last_line_of_output("uname -r"));231 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("uname -r")); 236 232 p = strchr(tmp, '.'); 237 233 if (p) { … … 244 240 } 245 241 } 246 // log_msg(1, "tmp = '%s'", tmp);247 242 d = atof(tmp); 243 mr_free(tmp); 248 244 #endif 249 245 log_msg(1, "g_kernel_version = %f", d); … … 252 248 253 249 254 255 256 257 250 /** 258 251 * Get the current time. … … 263 256 return (long) time((void *) 0); 264 257 } 265 266 267 268 269 270 258 271 259 … … 411 399 char *command = NULL; 412 400 char *mtpt; 413 char *hostname ;401 char *hostname = NULL; 414 402 char *ip_address = NULL; 415 403 int retval = 0; 416 404 char *colon; 417 char *cdr_exe ;405 char *cdr_exe = NULL; 418 406 char *tmp = NULL; 419 407 char *p = NULL; … … 431 419 432 420 malloc_string(mtpt); 433 malloc_string(hostname);434 malloc_string(cdr_exe);435 421 bkpinfo->optimal_set_size = 436 422 (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) * … … 496 482 tmp = find_home_of_exe("growisofs"); 497 483 if (tmp) { 498 strcpy(cdr_exe, "growisofs");484 mr_asprintf(cdr_exe, "growisofs"); 499 485 } // unlikely to be used 500 486 else { … … 560 546 tmp = find_home_of_exe("cdrecord"); 561 547 if (tmp) { 562 strcpy(cdr_exe, "cdrecord");548 mr_asprintf(cdr_exe, "cdrecord"); 563 549 } else { 564 550 mr_free(tmp); 565 551 tmp = find_home_of_exe("dvdrecord"); 566 552 if (tmp) { 567 strcpy(cdr_exe, "dvdrecord");553 mr_asprintf(cdr_exe, "dvdrecord"); 568 554 } else { 569 555 mr_free(tmp); … … 590 576 } 591 577 #endif 592 else 593 { 578 else { 594 579 mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX); 595 580 } … … 613 598 mr_asprintf(bkpinfo->call_make_iso, "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -", mondo_mkisofs_sz, cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", extra_cdrom_params, bkpinfo->media_device, bkpinfo->cdrw_speed); 614 599 } 600 mr_free(cdr_exe); 615 601 paranoid_free(mondo_mkisofs_sz); 616 602 paranoid_free(extra_cdrom_params); … … 654 640 mr_asprintf(iso_path, "%s", iso_tmp + strlen(iso_mnt)); 655 641 } 642 mr_free(iso_mnt); 656 643 mr_free(iso_tmp); 657 644 … … 674 661 if (bkpinfo->backup_media_type == nfs) { 675 662 if (bkpinfo->nfs_mount) { 676 strcpy(hostname, bkpinfo->nfs_mount);663 mr_asprintf(hostname, "%s", bkpinfo->nfs_mount); 677 664 } else { 678 665 log_it("nfs_mount is NULL"); 679 666 retval++; 680 strcpy(hostname, "");667 mr_asprintf(hostname, ""); 681 668 } 682 669 colon = strchr(hostname, ':'); … … 699 686 } 700 687 } 688 mr_free(hostname); 701 689 store_nfs_config(); 702 690 } … … 712 700 g_backup_media_type = bkpinfo->backup_media_type; 713 701 paranoid_free(mtpt); 714 paranoid_free(hostname);715 paranoid_free(cdr_exe);716 702 return (retval); 717 703 } … … 1254 1240 mr_asprintf(command, "mount | grep -Ew '/boot'"); 1255 1241 mr_free(tmp); 1256 mr_asprintf(tmp, call_program_and_get_last_line_of_output(command));1242 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 1257 1243 mr_free(command); 1258 1244
Note:
See TracChangeset
for help on using the changeset viewer.