Changeset 2099 in MondoRescue
- Timestamp:
- Dec 23, 2008, 11:35:19 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.8/mondo/src/common/libmondo-filelist.c
r2059 r2099 1364 1364 struct dirent *dit; 1365 1365 struct stat statbuf; 1366 char new[MAX_STR_LEN];1366 char *new; 1367 1367 char *tmp; 1368 char *sth_B;1369 1368 static int percentage = 0; 1370 char *ith_B;1371 1369 char *skip_these; 1372 1370 char *new_with_spaces; … … 1386 1384 time_t this_time; 1387 1385 1388 malloc_string(tmp);1389 sth_B = malloc(8*MAX_STR_LEN);1390 malloc_string(ith_B);1391 malloc_string(new_with_spaces);1392 1386 p = strrchr(dir, '/'); 1393 1387 if (p) { … … 1423 1417 system(strtmp); 1424 1418 paranoid_free(strtmp); 1425 sprintf(tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);1419 asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist); 1426 1420 g_skeleton_entries = 1427 1421 1 + atol(call_program_and_get_last_line_of_output(tmp)); 1422 paranoid_free(tmp); 1428 1423 sprintf(name_of_evalcall_form, "Making catalog of %s", dir); 1429 1424 open_evalcall_form(name_of_evalcall_form); … … 1452 1447 #ifndef _XWIN 1453 1448 if (!g_text_mode) { 1454 sprintf(tmp, "Reading %-68s", dir);1449 asprintf(&tmp, "Reading %-68s", dir); 1455 1450 newtDrawRootText(0, g_noof_rows - 3, tmp); 1451 paranoid_free(tmp); 1456 1452 } 1457 1453 #endif … … 1465 1461 // log_msg(0, "Cataloguing %s", dir); 1466 1462 if (sth[0] == ' ') { 1467 skip_these = sth;1463 asprintf(&skip_these, "%s", sth); 1468 1464 } else { 1469 skip_these = sth_B; 1470 sprintf(skip_these, " %s ", sth); 1471 } 1472 sprintf(new_with_spaces, " %s ", dir); 1465 asprintf(&skip_these, " %s ", sth); 1466 } 1467 asprintf(&new_with_spaces, " %s ", dir); 1473 1468 if ((dip = opendir(dir)) == NULL) { 1474 sprintf(tmp,"opendir %s", dir);1469 asprintf(&tmp,"opendir %s", dir); 1475 1470 log_OS_error(tmp); 1471 paranoid_free(tmp); 1476 1472 } else if (strstr(skip_these, new_with_spaces)) { 1477 1473 fprintf(fout, "%s\n", dir); // if excluded dir then print dir ONLY … … 1480 1476 while ((dit = readdir(dip)) != NULL) { 1481 1477 i++; 1482 strcpy(new, dir);1483 1478 if (strcmp(dir, "/")) { 1484 strcat(new, "/"); 1479 asprintf(&new,"%s/%s",dir,dit->d_name); 1480 } else { 1481 asprintf(&new,"%s%s",dir,dit->d_name); 1485 1482 } 1486 strcat(new, dit->d_name); 1487 new_with_spaces[0] = ' '; 1488 strcpy(new_with_spaces + 1, new); 1489 strcat(new_with_spaces, " "); 1483 paranoid_free(new_with_spaces); 1484 asprintf(&new_with_spaces, " %s ", new); 1490 1485 if (strstr(skip_these, new_with_spaces)) { 1491 1486 fprintf(fout, "%s\n", new); 1487 paranoid_free(new_with_spaces); 1492 1488 } else { 1489 paranoid_free(new_with_spaces); 1493 1490 if (!lstat(new, &statbuf)) { 1494 1491 if (!S_ISLNK(statbuf.st_mode) … … 1504 1501 counter = 0; 1505 1502 uberctr++; 1506 sprintf(tmp, " %c ",1503 asprintf(&tmp, " %c ", 1507 1504 special_dot_char(uberctr)); 1508 1505 #ifndef _XWIN … … 1513 1510 } 1514 1511 #endif 1512 paranoid_free(tmp); 1515 1513 } 1516 1514 } … … 1518 1516 } 1519 1517 } 1520 } 1521 } 1518 paranoid_free(new); 1519 } 1520 } 1521 paranoid_free(new_with_spaces); 1522 paranoid_free(skip_these); 1523 1522 1524 if (dip) { 1523 1525 if (closedir(dip) == -1) { … … 1533 1535 log_msg(5, "g_skeleton_entries = %ld", g_skeleton_entries); 1534 1536 } 1535 paranoid_free(tmp);1536 paranoid_free(sth_B);1537 paranoid_free(ith_B);1538 paranoid_free(new_with_spaces);1539 1537 return (0); 1540 1538 } … … 1587 1585 char *userdef_filelist) 1588 1586 { 1589 char sz_datefile_wildcard[] = MONDO_CACHE"/difflevel.%d";1590 1587 char *p, *q; 1591 char sz_datefile[80];1588 char *sz_datefile; 1592 1589 char *sz_filelist, *exclude_paths, *tmp; 1593 1590 int i; … … 1601 1598 malloc_string(command); 1602 1599 malloc_string(tmp); 1603 malloc_string(sz_filelist);1604 1600 malloc_string(g_skeleton_filelist); 1605 1601 if (!(exclude_paths = malloc(8*MAX_STR_LEN))) { 1606 1602 fatal_error("Cannot malloc exclude_paths"); 1607 1603 } 1608 sprintf(sz_datefile, sz_datefile_wildcard, 0);1604 asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0); 1609 1605 if (!include_paths && !userdef_filelist) { 1610 1606 fatal_error … … 1614 1610 sprintf(command, "mkdir -p %s/archives", scratchdir); 1615 1611 paranoid_system(command); 1616 sprintf(sz_filelist, "%s/tmpfs/filelist.full", tmpdir);1612 asprintf(&sz_filelist, "%s/tmpfs/filelist.full", tmpdir); 1617 1613 make_hole_for_file(sz_filelist); 1618 1614 … … 1640 1636 log_msg(2, "Differential backup. Yay."); 1641 1637 } 1638 paranoid_free(sz_datefile); 1642 1639 1643 1640 // use user-specified filelist (if specified) … … 1707 1704 sprintf(command, "mv -f %s %s", sz_filelist, tmpdir); 1708 1705 paranoid_system(command); 1706 paranoid_free(sz_filelist); 1709 1707 log_msg(2, "Freeing variables"); 1710 paranoid_free(sz_filelist);1711 1708 paranoid_free(command); 1712 1709 paranoid_free(exclude_paths);
Note:
See TracChangeset
for help on using the changeset viewer.