- Timestamp:
- Aug 18, 2009, 3:33:19 PM (16 years ago)
- Location:
- branches/2.2.10
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-cli.c
r2331 r2332 893 893 flag_set['d'] = TRUE; 894 894 strcpy(flag_val['d'], p); 895 mr_free(p); 895 896 log_to_screen("You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']); 896 897 percent = 0; … … 1551 1552 case SIGKILL: 1552 1553 mr_asprintf(tmp, "SIGKILL"); 1553 mr_asprintf(tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system."); 1554 mr_asprintf(tmp2, 1555 "I seriously have no clue how this signal even got to me. Something's wrong with your system."); 1554 1556 break; 1555 1557 case SIGTERM: … … 1563 1565 case SIGSEGV: 1564 1566 mr_asprintf(tmp, "SIGSEGV"); 1565 mr_asprintf(tmp2, "Internal programming error. Please send a backtrace as well as your log."); 1567 mr_asprintf(tmp2, 1568 "Internal programming error. Please send a backtrace as well as your log."); 1566 1569 break; 1567 1570 case SIGPIPE: -
branches/2.2.10/mondo/src/common/libmondo-devices.c
r2331 r2332 1413 1413 char *tmp = NULL; 1414 1414 char *p = NULL; 1415 char *tmp1 = NULL; 1415 1416 char *mds = NULL; 1416 1417 char *sz_size = NULL; -
branches/2.2.10/mondo/src/common/libmondo-fifo.c
r2324 r2332 88 88 for (bufsize = wise_upper_limit, res = -1; 89 89 res != 0 && bufsize >= wise_lower_limit; bufsize--) { 90 mr_asprintf(tmp, 90 mr_asprintf(tmp,"dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", internal_tape_block_size, bufsize, 'm'); 91 91 res = run_program_and_log_output(tmp, 2); 92 92 mr_free(tmp); -
branches/2.2.10/mondo/src/common/libmondo-files.c
r2331 r2332 1103 1103 } 1104 1104 *(p++) = '\0'; 1105 mr_asprintf(nfs_server_ipaddr, "%s",tmp);1106 mr_asprintf(nfs_mount, "%s",p);1105 mr_asprintf(nfs_server_ipaddr, tmp); 1106 mr_asprintf(nfs_mount, p); 1107 1107 mr_free(tmp); 1108 1108 … … 1151 1151 mr_free(nfs_dev); 1152 1152 1153 mr_asprintf(nfs_dev, "%s",call_program_and_get_last_line_of_output(command));1153 mr_asprintf(nfs_dev, call_program_and_get_last_line_of_output(command)); 1154 1154 mr_free(command); 1155 1155 -
branches/2.2.10/mondo/src/common/libmondo-stream.c
r2331 r2332 246 246 * @return the allocated tape string if success, NULL if failure 247 247 */ 248 char *mr_find_tape_device(void) 249 { 248 char *mr_find_tape_device(void) { 249 250 250 char *tmp = NULL; 251 251 char *command = NULL; … … 256 256 257 257 log_to_screen("I am looking for your tape streamer. Please wait."); 258 258 259 tmp = find_home_of_exe("cdrecord"); 259 260 if (tmp) { 260 261 mr_asprintf(cdr_exe, "cdrecord"); 262 261 263 } else { 262 264 mr_asprintf(cdr_exe, "dvdrecord"); … … 270 272 if (atoi(tmp) != 1) { 271 273 log_it("Either too few or too many tape streamers for me to detect..."); 272 mr_asprintf( &dev, "%s", VANILLA_SCSI_TAPE);274 mr_asprintf(dev, "%s", VANILLA_SCSI_TAPE); 273 275 mr_free(tmp); 274 276 mr_free(tmp); … … 290 292 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe); 291 293 mr_free(cdr_exe); 292 293 294 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command)); 294 295 mr_free(command); … … 301 302 if (!mt_says_tape_exists(dev)) { 302 303 mr_free(dev); 303 mr_asprintf( &dev, "%s", ALT_TAPE);304 mr_asprintf(dev, "%s", ALT_TAPE); 304 305 if (!mt_says_tape_exists(dev)) { 305 306 log_it("Cannot openin %s", dev); 306 307 mr_free(dev); 307 mr_asprintf( &dev, "/dev/st0");308 mr_asprintf(dev, "/dev/st0"); 308 309 if (!mt_says_tape_exists(dev)) { 309 310 log_it("Cannot openin %s", dev); 310 311 mr_free(dev); 311 mr_asprintf( &dev, "/dev/osst0");312 mr_asprintf(dev, "/dev/osst0"); 312 313 if (!mt_says_tape_exists(dev)) { 313 314 mr_free(dev); … … 335 336 mr_asprintf(tmp, "%s", (strrchr(dev, '/') != NULL) ? strrchr(dev, '/') : dev); 336 337 mr_free(dev); 337 mr_asprintf( &dev, "/dev/os%s", tmp);338 mr_asprintf(dev, "/dev/os%s", tmp); 338 339 log_it("...into %s", dev); 339 340 if (mt_says_tape_exists(dev)) { … … 345 346 } 346 347 347 log_it("res=%d; dev=%s", res, dev);348 349 348 if (dev) { 350 349 log_it("At this new point, dev = %s and res = %d", dev, res); 351 350 } else { 352 log_it("At this new point, dev is NULL and res = %d", dev,res);351 log_it("At this new point, dev is NULL and res = %d", res); 353 352 mr_free(tmp); 354 return(NULL);355 353 } 356 354 -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2331 r2332 956 956 ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE); 957 957 } 958 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output 958 mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2")); 959 959 if (atol(tmp) < 35000) { 960 960 retval++; … … 1112 1112 log_to_screen("(read_cfg_var) Cannot find %s config file", config_file); 1113 1113 return (NULL); 1114 /* BERLIOS: not sure the sage of this one ?1114 /* BERLIOS: not sure the usage of this one ? 1115 1115 } else if ((value != NULL) && (strstr(value, "/dev/") && strstr(value, "t0") && !strcmp(label, "media-dev"))) { 1116 1116 log_msg(2, "FYI, I can't read new value for %s - already got %s", label, value); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c
r2331 r2332 111 111 } 112 112 113 mr_asprintf( &command_ptr, "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors", MNT_RESTORING, bigfile_fname_ptr);113 mr_asprintf(command_ptr, "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors", MNT_RESTORING, bigfile_fname_ptr); 114 114 log_msg(2, command_ptr); 115 115 i = system(command_ptr); … … 207 207 noof_biggiefiles); 208 208 for (bigfileno = 0; bigfileno < noof_biggiefiles; bigfileno++) { 209 mr_asprintf( &tmp, "Comparing big file #%ld", bigfileno + 1);209 mr_asprintf(tmp, "Comparing big file #%ld", bigfileno + 1); 210 210 log_msg(1, tmp); 211 211 update_progress_form(tmp); … … 251 251 char *tmp = NULL; 252 252 char *archiver_exe = NULL; 253 char *tmp1 = NULL; 253 254 char *filelist_name = NULL; 254 255 char *logfile = NULL; … … 257 258 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 258 259 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 259 mr_asprintf( &filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number);260 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number); 260 261 noof_lines = count_lines_in_file(filelist_name); 261 262 mr_free(filelist_name); 262 263 263 264 if (strstr(tarball_fname, ".bz2")) { 264 mr_asprintf( &compressor_exe, "bzip2");265 mr_asprintf(compressor_exe, "bzip2"); 265 266 } else if (strstr(tarball_fname, ".gz")) { 266 mr_asprintf( &compressor_exe, "gzip");267 mr_asprintf(compressor_exe, "gzip"); 267 268 } else if (strstr(tarball_fname, ".lzo")) { 268 mr_asprintf( &compressor_exe, "lzop");269 mr_asprintf(compressor_exe, "lzop"); 269 270 } 270 271 … … 276 277 277 278 if (compressor_exe) { 278 if (!find_home_of_exe(compressor_exe)) { 279 tmp1 = find_home_of_exe(compressor_exe); 280 if (!tmp1) { 281 mr_free(tmp1); 279 282 mr_free(compressor_exe); 280 283 mr_free(archiver_exe); 281 284 fatal_error("(compare_a_tarball) Compression program missing"); 282 285 } 286 mr_free(tmp1); 287 283 288 if (use_star) { 284 289 if (!strcmp(compressor_exe, "bzip2")) { … … 292 297 // afio 293 298 mr_free(compressor_exe); 294 mr_asprintf( &tmp, "%s", compressor_exe);295 mr_asprintf( &compressor_exe, "-P %s -Z", tmp);299 mr_asprintf(tmp, "%s", compressor_exe); 300 mr_asprintf(compressor_exe, "-P %s -Z", tmp); 296 301 mr_free(tmp); 297 302 } … … 303 308 #define BUFSIZE (1024L*1024L)/TAPE_BLOCK_SIZE 304 309 #endif 305 mr_asprintf( &logfile, "/tmp/afio.log.%d", current_tarball_number);310 mr_asprintf(logfile, "/tmp/afio.log.%d", current_tarball_number); 306 311 307 312 if (use_star) { 308 313 // doesn't use compressor_exe 309 mr_asprintf( &command, "%s -diff H=star file=%s >> %s 2>> %s", archiver_exe, tarball_fname, logfile, logfile);310 } else { 311 mr_asprintf( &command, "%s -r -b %ld -M 16m -c %ld %s %s >> %s 2>> %s", archiver_exe, TAPE_BLOCK_SIZE, BUFSIZE, compressor_exe, tarball_fname, logfile, logfile);314 mr_asprintf(command, "%s -diff H=star file=%s >> %s 2>> %s", archiver_exe, tarball_fname, logfile, logfile); 315 } else { 316 mr_asprintf(command, "%s -r -b %ld -M 16m -c %ld %s %s >> %s 2>> %s", archiver_exe, TAPE_BLOCK_SIZE, BUFSIZE, compressor_exe, tarball_fname, logfile, logfile); 312 317 } 313 318 mr_free(compressor_exe); … … 325 330 326 331 if (length_of_file(logfile) > 5) { 327 mr_asprintf( &command, "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt", logfile);332 mr_asprintf(command, "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt", logfile); 328 333 system(command); 329 334 mr_free(command); … … 365 370 long max_val; 366 371 367 malloc_string(tarball_fname);368 malloc_string(progress_str);369 370 372 assert(bkpinfo != NULL); 371 373 mvaddstr_and_log_it(g_currentY, 0, "Comparing archives"); … … 374 376 mr_free(tmp); 375 377 376 paranoid_free(tmp);377 378 378 mds = media_descriptor_string(bkpinfo->backup_media_type); 379 mr_asprintf( &progress_str, "Comparing with %s #%d ", mds, g_current_media_number);379 mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number); 380 380 381 381 open_progress_form("Comparing files", … … 389 389 insist_on_this_cd_number(g_current_media_number); 390 390 update_progress_form(progress_str); 391 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number);391 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number); 392 392 393 393 if (!does_file_exist(tarball_fname)) { 394 394 mr_free(tarball_fname); 395 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number);395 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number); 396 396 } 397 397 if (!does_file_exist(tarball_fname)) { 398 398 mr_free(tarball_fname); 399 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number);399 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number); 400 400 } 401 401 if (!does_file_exist(tarball_fname)) { 402 402 mr_free(tarball_fname); 403 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number);403 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number); 404 404 } 405 405 if (!does_file_exist(tarball_fname)) { 406 406 mr_free(tarball_fname); 407 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number);407 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number); 408 408 } 409 409 if (!does_file_exist(tarball_fname)) { 410 410 mr_free(tarball_fname); 411 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number);411 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number); 412 412 } 413 413 if (!does_file_exist(tarball_fname)) { … … 424 424 425 425 mr_free(progress_str); 426 mr_asprintf( &progress_str, "Comparing with %s #%d ", mds, g_current_media_number);426 mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number); 427 427 log_to_screen(progress_str); 428 428 } else { … … 490 490 noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt"); 491 491 if (noof_changed_files) { 492 mr_asprintf( &tmp, "%ld files do not match the backup ", noof_changed_files);492 mr_asprintf(tmp, "%ld files do not match the backup ", noof_changed_files); 493 493 log_to_screen(tmp); 494 494 mr_free(tmp); 495 495 496 mr_asprintf( &command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE);496 mr_asprintf(command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE); 497 497 paranoid_system(command); 498 498 mr_free(command); 499 499 } else { 500 mr_asprintf( &tmp, "All files match the backup ");500 mr_asprintf(tmp, "All files match the backup "); 501 501 mvaddstr_and_log_it(g_currentY++, 0, tmp); 502 502 log_to_screen(tmp); … … 563 563 if (g_text_mode) { 564 564 save_mountlist_to_disk(mountlist, g_mountlist_fname); 565 mr_asprintf( &tmp, "%s %s", find_my_editor(), g_mountlist_fname);565 mr_asprintf(tmp, "%s %s", find_my_editor(), g_mountlist_fname); 566 566 res = system(tmp); 567 567 mr_free(tmp); … … 612 612 } else { 613 613 q = count_lines_in_file(MONDO_CACHE"/changed.files"); 614 mr_asprintf( &tmp, "%ld significant difference%s found.", q, (q != 1) ? "s" : "");614 mr_asprintf(tmp, "%ld significant difference%s found.", q, (q != 1) ? "s" : ""); 615 615 mvaddstr_and_log_it(g_currentY++, 0, tmp); 616 616 log_to_screen(tmp); 617 617 mr_free(tmp); 618 618 619 mr_asprintf( &tmp, "Type 'less /tmp/changed.files' for a list of non-matching files");619 mr_asprintf(tmp, "Type 'less /tmp/changed.files' for a list of non-matching files"); 620 620 mvaddstr_and_log_it(g_currentY++, 0, tmp); 621 621 log_to_screen(tmp); … … 723 723 getcwd(dir, MAX_STR_LEN); 724 724 chdir(bkpinfo->restore_path); 725 mr_asprintf( &command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);725 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path); 726 726 run_program_and_log_output(command, FALSE); 727 727 mr_free(command); -
branches/2.2.10/tools/myval
r2320 r2332 3 3 # Call valgrind to test mondo 4 4 5 sudo valgrind --log-file=/tmp/val.log --show-reachable=yes -- leak-check=full /bruno/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -G-I /etc -d /home6 sudo valgrind --log-file=/tmp/valg.log --show-reachable=yes -- leak-check=full /bruno/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -I /etc -G -g-d /home5 sudo valgrind --log-file=/tmp/val.log --show-reachable=yes --track-origins=yes --leak-check=full /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -I /etc -d /home 6 sudo valgrind --log-file=/tmp/valg.log --show-reachable=yes --track-origins=yes --leak-check=full /home/bruno/local/pb/projects/mondorescue/build/BUILD/mondo-2.2.10/src/mondoarchive/mondoarchive -K 99 -Oi -g -G -I /etc -E /etc/init.d -d /home -
branches/2.2.10/tools/quality
r2321 r2332 28 28 29 29 # How many sprintf/strcat/strcpy vs asprintf are they 30 for s in asprintf mr_asprintf sprintf snprintf strcat str cpy strncpy fgets malloc mr_malloc malloc_string getline mr_getline MAX_STR_LEN getcwd goto free mr_free paranoid_free paranoid_system mr_system assert; do30 for s in asprintf mr_asprintf sprintf snprintf strcat strncat strcpy strncpy fgets malloc mr_malloc malloc_string getline mr_getline MAX_STR_LEN getcwd goto free mr_free paranoid_free paranoid_system mr_system assert; do 31 31 echo "mondorescue $s usage : " 32 32 tot=0
Note:
See TracChangeset
for help on using the changeset viewer.