Ignore:
Timestamp:
Jun 26, 2006, 1:12:48 PM (18 years ago)
Author:
bcornec
Message:

Attempt to fix Bug #7820 Does not backup a file greater than 2 GB
Report from taps23@…
Changed legnth_of_file to off_t for ftello support and all relative changes made as well in various functions to be consistent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/mondo/common/libmondo-stream.c

    r541 r684  
    259259    log_it("closeout_tape() -- entering");
    260260    retval +=
    261         write_header_block_to_stream(0, "end-of-backup",
     261        write_header_block_to_stream((off_t)0, "end-of-backup",
    262262                                     BLK_END_OF_BACKUP);
    263     retval += write_header_block_to_stream(0, "end-of-tape", BLK_END_OF_TAPE);  /* just in case */
     263    retval += write_header_block_to_stream((off_t)0, "end-of-tape", BLK_END_OF_TAPE);   /* just in case */
    264264/* write 1MB of crap */
    265265    for (i = 0; i < 256 * 1024; i++) {
     
    269269        (void) fwrite(blk, 1, 256 * 1024, g_tape_stream);
    270270        if (should_we_write_to_next_tape
    271             (bkpinfo->media_size[g_current_media_number], 256 * 1024)) {
     271            (bkpinfo->media_size[g_current_media_number], (off_t)256 * 1024)) {
    272272            start_to_write_to_next_tape(bkpinfo);
    273273        }
     
    490490                                 BLK_START_EXAT_FILE);
    491491    write_file_to_stream_from_file(bkpinfo, xattr_fname);
    492     write_header_block_to_stream(-1, xattr_fname, BLK_STOP_EXAT_FILE);
     492    write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE);
    493493// acl
    494494    write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
    495495                                 BLK_START_EXAT_FILE);
    496496    write_file_to_stream_from_file(bkpinfo, acl_fname);
    497     write_header_block_to_stream(-1, acl_fname, BLK_STOP_EXAT_FILE);
     497    write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE);
    498498    write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
    499499                                 BLK_STOP_EXTENDED_ATTRIBUTES);
     
    11961196 * autodetecting the size. Huh?
    11971197 */
     1198
     1199/* BERLIOS: Should be reviewed for mediasize being a off_t ??? */
    11981200bool
    11991201should_we_write_to_next_tape(long mediasize,
    1200                              long long length_of_incoming_file)
     1202                             off_t length_of_incoming_file)
    12011203{
    12021204    /*@ bool's ***************************************************** */
     
    14341436    g_tape_posK = 0;
    14351437    g_sigpipe = FALSE;
    1436     res += write_header_block_to_stream(0, "start-of-tape", BLK_START_OF_TAPE); /* just in case */
    1437     res += write_header_block_to_stream(0, "start-of-backup", BLK_START_OF_BACKUP); /* just in case */
     1438    res += write_header_block_to_stream((off_t)0, "start-of-tape", BLK_START_OF_TAPE);  /* just in case */
     1439    res += write_header_block_to_stream((off_t)0, "start-of-backup", BLK_START_OF_BACKUP);  /* just in case */
    14381440    return (res);
    14391441}
     
    14771479            }
    14781480            if (i != last) {
    1479                 write_header_block_to_stream(0,
     1481                write_header_block_to_stream((off_t)0,
    14801482                                             "stop-backcatalog-afio-or-slice",
    14811483                                             BLK_STOP_AN_AFIO_OR_SLICE);
     
    15821584    long i;
    15831585
    1584     /*@ long long ************************************************** */
    1585     long long filesize;
     1586    off_t filesize;
    15861587
    15871588#ifdef EXTRA_TAPE_CHECKSUMS
     
    16581659    paranoid_fclose(fin);
    16591660    sprintf(checksum, "%04x%04x", crc16, crctt);
    1660     write_header_block_to_stream(g_current_media_number, checksum,
     1661    /* BERLIOS: what does it do ??? */
     1662    write_header_block_to_stream((off_t)g_current_media_number, checksum,
    16611663                                 BLK_STOP_FILE);
    16621664//  log_it("File '%s' written to tape.", infile);
     
    16801682 */
    16811683int
    1682 write_header_block_to_stream(long long length_of_incoming_file,
     1684write_header_block_to_stream(off_t length_of_incoming_file,
    16831685                             char *filename, int control_char)
    16841686{
     
    16911693    int i;
    16921694
    1693     /*@ long long ************************************************** */
    1694     long long olen;
     1695    off_t olen;
    16951696
    16961697    /*@ end vars *************************************************** */
     
    17151716    tempblock[7000] = control_char;
    17161717/*  for(i=0;i<8;i++) {tempblock[7001+i]=olen&0xff; olen>>=8;} */
    1717     memcpy(tempblock + 7001, (char *) &olen, sizeof(long long));
     1718    memcpy(tempblock + 7001, (char *) &olen, sizeof(off_t));
    17181719/*  if (length_of_incoming_file) {memcpy(tempblock+7001,(char*)&length_of_incoming_file,sizeof(long long));} */
    17191720    strcpy(tempblock + 1000, filename);
Note: See TracChangeset for help on using the changeset viewer.