Changeset 2301 in MondoRescue
- Timestamp:
- Jul 23, 2009, 7:52:12 PM (15 years ago)
- Location:
- branches/2.2.10
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-archive.c
r2296 r2301 1213 1213 mr_asprintf(&data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir); 1214 1214 1215 snprintf(g_serial_string, MAX_STR_LEN - 8, "%s", 1216 call_program_and_get_last_line_of_output("dd \ 1217 if=/dev/urandom bs=16 count=1 2> /dev/null | \ 1218 hexdump | tr -s ' ' '0' | head -n1")); 1215 mr_sprintf(&g_serial_string, "%s", call_program_and_get_last_line_of_output("dd if=/dev/urandom bs=16 count=1 2> /dev/null | hexdump | tr -s ' ' '0' | head -n1")); 1219 1216 strip_spaces(g_serial_string); 1220 strcat(g_serial_string, "...word.");1217 mr_strcat(g_serial_string, "...word."); 1221 1218 log_msg(2, "g_serial_string = '%s'", g_serial_string); 1222 assert(strlen(g_serial_string) < MAX_STR_LEN);1223 1219 1224 1220 mr_asprintf(&tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir); … … 2764 2760 run_program_and_log_output(szunmount, 1); 2765 2761 log_msg(2, "paafcd: cd_number = %d", cd_number); 2766 log_msg(2, "our serial str = %s; g_serial_string = %s", 2767 our_serial_str, g_serial_string); 2762 log_msg(2, "our serial str = %s; g_serial_string = %s", our_serial_str, g_serial_string); 2768 2763 if (cd_number > 0 && !strcmp(our_serial_str, g_serial_string)) { 2769 2764 mds = media_descriptor_string(g_backup_media_type); -
branches/2.2.10/mondo/src/common/libmondo-tools.c
r2296 r2301 30 30 31 31 extern int g_tape_buffer_size_MB; 32 extern char *g_serial_string;33 32 extern bool g_text_mode; 34 33 extern int g_currentY; … … 1376 1375 1377 1376 /** 1378 * If @p y, malloc @p x, else free @p x.1379 * @bug This function seems orphaned. Please remove.1380 */1381 #define do_alloc_or_free_depending(x,y) { if(y) {x=malloc(MAX_STR_LEN);} else {paranoid_free(x);} }1382 1383 /**1384 1377 * Allocate or free important globals, depending on @p mal. 1385 1378 * @param mal If TRUE, malloc; if FALSE, free. … … 1393 1386 malloc_string(g_tmpfs_mountpt); 1394 1387 */ 1395 malloc_string(g_serial_string);1396 1388 malloc_string(g_magicdev_command); 1397 1389 } else { … … 1401 1393 paranoid_free(g_tmpfs_mountpt); 1402 1394 */ 1403 paranoid_free(g_serial_string);1395 mr_free(g_serial_string); 1404 1396 paranoid_free(g_magicdev_command); 1405 1397 1406 1398 } 1407 1408 /*1409 char**list_of_arrays[] = {1410 &g_boot_mountpt,1411 &g_mondo_home,1412 &g_tmpfs_mountpt,1413 &g_serial_string,1414 &g_magicdev_command,1415 NULL};1416 1417 char**ppcurr;1418 int i;1419 1420 for(i=0;list_of_arrays[i];i++)1421 {1422 log_msg(5, "Allocating %d", i);1423 ppcurr = list_of_arrays[i];1424 if (mal)1425 { *ppcurr = malloc(MAX_STR_LEN); }1426 else1427 {1428 if (*ppcurr)1429 {1430 free(*ppcurr);1431 }1432 }1433 }1434 log_msg(5, "Returning");1435 */1436 1399 } 1437 1400 -
branches/2.2.10/tools/quality
r2300 r2301 29 29 # How many sprintf/strcat/strcpy vs asprintf are they 30 30 for s in asprintf mr_asprintf sprintf snprintf strcat 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 echo "mon odrescue $s usage : "31 echo "mondorescue $s usage : " 32 32 tot=0 33 33 for i in `find . -name '*.c' -o -name '*.h' | egrep -v '\.svn|/\*|monitas|mindi-busybox' | xargs grep -r -c -w $s | egrep -v ":0$"`; do … … 42 42 pbg -w asprintf | grep -vE 'monitas|mindi-busybox|quality|/\*|asprintf\(&' > /tmp/mondo.quality 43 43 cat /tmp/mondo.quality 44 echo "mon odrescue uses : `cat /tmp/mondo.quality | wc -l` asprintf without &"44 echo "mondorescue uses : `cat /tmp/mondo.quality | wc -l` asprintf without &" 45 45 pbg -w getline | grep -vE 'monitas|mindi-busybox|quality|/\*|getline\(&' > /tmp/mondo.quality 46 46 cat /tmp/mondo.quality 47 echo "mon odrescue uses : `cat /tmp/mondo.quality | wc -l` getline without &"47 echo "mondorescue uses : `cat /tmp/mondo.quality | wc -l` getline without &" 48 48 pbg mr_asprintf | grep -vE '"|FNAME|ISOFS|syscall_sprintf|mr_mem|quality' > /tmp/mondo.quality 49 49 cat /tmp/mondo.quality 50 echo "mon odrescue uses : `cat /tmp/mondo.quality | wc -l` mr_aspritnf without \""50 echo "mondorescue uses : `cat /tmp/mondo.quality | wc -l` mr_aspritnf without \"" 51 51 echo " " 52 52 echo "Splint: "
Note:
See TracChangeset
for help on using the changeset viewer.