Changeset 1933


Ignore:
Timestamp:
May 7, 2008, 2:54:22 PM (11 years ago)
Author:
bruno
Message:

Attempt to fix #249 (adding START and STOP headers systematically for xattr and acl + more precise error messages

Location:
branches/2.2.6/mondo/src/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.6/mondo/src/common/libmondo-archive.c

    r1926 r1933  
    13551355    int i;
    13561356    char *curr_xattr_list_fname = NULL;
    1357     char *curr_acl_list_fname;
     1357    char *curr_acl_list_fname = NULL;
    13581358    int misc_counter_that_is_not_important = 0;
    13591359
     
    14691469                    write_EXAT_files_to_tape(curr_xattr_list_fname,
    14701470                                             curr_acl_list_fname);
    1471 // archives themselves
     1471                // archives themselves
    14721472                res +=
    14731473                    move_files_to_stream(storing_afioball_fname,
     
    22602260                write_EXAT_files_to_tape(curr_xattr_list_fname,
    22612261                                         curr_acl_list_fname);
    2262 // archives themselves
     2262            // archives themselves
    22632263            res = move_files_to_stream(curr_afioball_fname, NULL);
    22642264        } else {
  • branches/2.2.6/mondo/src/common/libmondo-stream.c

    r1913 r1933  
    446446{
    447447    int res = 0;
    448     int retval = 0;
    449448    char *fname = (char *)&res;                 /* Should NOT be NULL */
    450449
    451 // xattr
     450    // xattr
    452451    if (g_getfattr) {
    453452        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
     
    456455        }
    457456        if (!strstr(fname, "xattr")) {
    458             fatal_error("Wrong order, sunshine.");
     457            fatal_error("Wrong order for xattr, sunshine.");
    459458        }
    460459        read_file_from_stream_to_file(xattr_fname, *ptmp_size);
     
    464463        }
    465464        log_msg(1, "Got xattr");
    466     }
    467 // acl
     465        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     466        if (*pctrl_chr != BLK_STOP_EXTENDED_ATTRIBUTES) {
     467            wrong_marker(BLK_STOP_EXTENDED_ATTRIBUTES, *pctrl_chr);
     468        }
     469        res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     470        if (pctrl_chr == BLK_START_AN_AFIO_OR_SLICE) {
     471            log_msg(1, "No acl attributes found, skipping to afio files");
     472            return(0);
     473        } else {
     474            if (pctrl_chr != BLK_START_EXTENDED_ATTRIBUTES) {
     475                wrong_marker(BLK_START_EXTENDED_ATTRIBUTES, *pctrl_chr);
     476            }
     477        }
     478    }
     479    // acl
    468480    if (g_getfacl) {
    469481        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    470482        if (!strstr(fname, "acl")) {
    471             fatal_error("Wrong order, sunshine.");
     483            fatal_error("Wrong order for acl, sunshine.");
    472484        }
    473485        if (*pctrl_chr != BLK_START_EXAT_FILE) {
     
    485497        log_msg(1, "Got acl");
    486498    }
    487 // tarball itself
     499    // tarball itself
    488500    res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    489     log_msg(1, "now looking for afioball");
    490     return (retval);
     501    log_msg(1, "End of extended attributes, now looking for afioball");
     502    return (0);
    491503}
    492504
     
    504516        write_file_to_stream_from_file(xattr_fname);
    505517        write_header_block_to_stream((off_t)-1, xattr_fname, BLK_STOP_EXAT_FILE);
     518        write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
     519                             BLK_STOP_EXTENDED_ATTRIBUTES);
    506520    }
    507521    if (g_getfacl) {
    508522    // acl
     523        write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
     524                             BLK_START_EXTENDED_ATTRIBUTES);
    509525        write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
    510526                             BLK_START_EXAT_FILE);
    511527        write_file_to_stream_from_file(acl_fname);
    512528        write_header_block_to_stream((off_t)-1, acl_fname, BLK_STOP_EXAT_FILE);
    513         write_header_block_to_stream(length_of_file(xattr_fname), xattr_fname,
     529        write_header_block_to_stream(length_of_file(acl_fname), acl_fname,
    514530                             BLK_STOP_EXTENDED_ATTRIBUTES);
    515531    }
Note: See TracChangeset for help on using the changeset viewer.