Ignore:
Timestamp:
Nov 21, 2006, 1:42:46 AM (14 years ago)
Author:
Bruno Cornec
Message:

merge -r938:954 $SVN_M/branches/stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/src/common/libmondo-stream.c

    r900 r956  
    2929extern int g_tape_buffer_size_MB;
    3030
     31extern char *g_getfacl;
     32extern char *g_getfattr;
     33
    3134/**
    3235 * @addtogroup globalGroup
     
    346349
    347350// xattr
    348     res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    349     if (*pctrl_chr != BLK_START_EXAT_FILE) {
    350         wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
    351     }
    352     if (!strstr(fname, "xattr")) {
    353         fatal_error("Wrong order, sunshine.");
     351    if (g_getfattr) {
     352        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
     353        if (*pctrl_chr != BLK_START_EXAT_FILE) {
     354            wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
     355        }
     356        if (!strstr(fname, "xattr")) {
     357            fatal_error("Wrong order, sunshine.");
     358        }
     359        read_file_from_stream_to_file(bkpinfo, xattr_fname, *ptmp_size);
     360        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     361        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
     362            wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
     363        }
     364        log_msg(1, "Got xattr");
    354365    }
    355366    mr_free(fname);
     
    361372    }
    362373    // acl
    363     res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    364     if (!strstr(fname, "acl")) {
    365         fatal_error("Wrong order, sunshine.");
     374    if (g_getfacl) {
     375        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
     376        if (!strstr(fname, "acl")) {
     377            fatal_error("Wrong order, sunshine.");
     378        }
     379        if (*pctrl_chr != BLK_START_EXAT_FILE) {
     380            wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
     381        }
     382        read_file_from_stream_to_file(bkpinfo, acl_fname, *ptmp_size);
     383        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     384        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
     385            wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
     386        }
     387        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     388        if (*pctrl_chr != BLK_STOP_EXTENDED_ATTRIBUTES) {
     389            wrong_marker(BLK_STOP_EXTENDED_ATTRIBUTES, *pctrl_chr);
     390        }
     391        log_msg(1, "Got acl");
    366392    }
    367393    mr_free(fname);
     
    380406    }
    381407    // tarball itself
    382     res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    383     log_msg(1, "Got xattr and acl; now looking for afioball");
    384     tmp_fname = fname;
     408    res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     409    log_msg(1, "now looking for afioball");
    385410    return (retval);
    386411}
     
    391416{
    392417    int res = 0;
    393     // EXATs
    394     write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
    395                                  BLK_START_EXTENDED_ATTRIBUTES);
     418    if (g_getfattr) {
    396419    // xattr
    397     write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
    398                                  BLK_START_EXAT_FILE);
    399     write_file_to_stream_from_file(bkpinfo, xattr_fname);
    400     write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE);
    401 // acl
    402     write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
    403                                  BLK_START_EXAT_FILE);
    404     write_file_to_stream_from_file(bkpinfo, acl_fname);
    405     write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE);
    406     write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
    407                                  BLK_STOP_EXTENDED_ATTRIBUTES);
     420        write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
     421                             BLK_START_EXTENDED_ATTRIBUTES);
     422        write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
     423                             BLK_START_EXAT_FILE);
     424        write_file_to_stream_from_file(bkpinfo, xattr_fname);
     425        write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE);
     426    }
     427    if (g_getfacl) {
     428    // acl
     429        write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
     430                             BLK_START_EXAT_FILE);
     431        write_file_to_stream_from_file(bkpinfo, acl_fname);
     432        write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE);
     433        write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
     434                             BLK_STOP_EXTENDED_ATTRIBUTES);
     435    }
    408436    return (res);
    409437}
Note: See TracChangeset for help on using the changeset viewer.