From c5aeaae6c7fba4ca0f5901ec2a121146e305e632 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 4 May 2011 11:39:57 +0200 Subject: [PATCH] Add stat packet size to encode/decode_ routines to detect compile differences --- bacula/src/dird/ua_dotcmds.c | 4 ++-- bacula/src/dird/ua_tree.c | 10 ++++---- bacula/src/dird/verify.c | 6 ++--- bacula/src/filed/accurate.c | 6 ++--- bacula/src/filed/backup.c | 2 +- bacula/src/filed/restore.c | 4 ++-- bacula/src/filed/verify.c | 4 ++-- bacula/src/filed/xattr.c | 16 ++++++------- bacula/src/findlib/attribs.c | 28 ++++++++++++++++++---- bacula/src/findlib/protos.h | 6 ++--- bacula/src/qt-console/restore/brestore.cpp | 14 +++++------ bacula/src/stored/bextract.c | 2 +- bacula/src/stored/bls.c | 4 ++-- bacula/src/stored/bscan.c | 4 ++-- bacula/src/tools/bvfs_test.c | 7 +++--- 15 files changed, 68 insertions(+), 49 deletions(-) diff --git a/bacula/src/dird/ua_dotcmds.c b/bacula/src/dird/ua_dotcmds.c index a2f9c288b6..9959298bbc 100644 --- a/bacula/src/dird/ua_dotcmds.c +++ b/bacula/src/dird/ua_dotcmds.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2010 Free Software Foundation Europe e.V. + Copyright (C) 2002-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -211,7 +211,7 @@ static int bvfs_result_handler(void *ctx, int fields, char **row) } memset(&statp, 0, sizeof(struct stat)); - decode_stat(lstat, &statp, &LinkFI); + decode_stat(lstat, &statp, sizeof(statp), &LinkFI); Dmsg1(100, "type=%s\n", row[0]); if (bvfs_is_dir(row)) { diff --git a/bacula/src/dird/ua_tree.c b/bacula/src/dird/ua_tree.c index 71117a94ef..84c0898585 100644 --- a/bacula/src/dird/ua_tree.c +++ b/bacula/src/dird/ua_tree.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2010 Free Software Foundation Europe e.V. + Copyright (C) 2002-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -205,7 +205,7 @@ int insert_tree_handler(void *ctx, int num_fields, char **row) } else { type = TN_FILE; } - hard_link = (decode_LinkFI(row[4], &statp) != 0); + hard_link = (decode_LinkFI(row[4], &statp, sizeof(statp)) != 0); node = insert_tree_node(row[0], row[1], type, tree->root, NULL); JobId = str_to_int64(row[3]); FileIndex = str_to_int64(row[2]); @@ -322,7 +322,7 @@ static int set_extract(UAContext *ua, TREE_NODE *node, TREE_CTX *tree, bool extr fdbr.JobId = node->JobId; if (node->hard_link && db_get_file_attributes_record(ua->jcr, ua->db, cwd, NULL, &fdbr)) { int32_t LinkFI; - decode_stat(fdbr.LStat, &statp, &LinkFI); /* decode stat pkt */ + decode_stat(fdbr.LStat, &statp, sizeof(statp), &LinkFI); /* decode stat pkt */ /* * If we point to a hard linked file, traverse the tree to * find that file, and mark it to be restored as well. It @@ -705,7 +705,7 @@ static int do_dircmd(UAContext *ua, TREE_CTX *tree, bool dot_cmd) } if (db_get_file_attributes_record(ua->jcr, ua->db, pcwd, NULL, &fdbr)) { int32_t LinkFI; - decode_stat(fdbr.LStat, &statp, &LinkFI); /* decode stat pkt */ + decode_stat(fdbr.LStat, &statp, sizeof(statp), &LinkFI); /* decode stat pkt */ } else { /* Something went wrong getting attributes -- print name */ memset(&statp, 0, sizeof(statp)); @@ -750,7 +750,7 @@ static int estimatecmd(UAContext *ua, TREE_CTX *tree) fdbr.JobId = node->JobId; if (db_get_file_attributes_record(ua->jcr, ua->db, cwd, NULL, &fdbr)) { int32_t LinkFI; - decode_stat(fdbr.LStat, &statp, &LinkFI); /* decode stat pkt */ + decode_stat(fdbr.LStat, &statp, sizeof(statp), &LinkFI); /* decode stat pkt */ if (S_ISREG(statp.st_mode) && statp.st_size > 0) { total_bytes += statp.st_size; } diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 41cb9019cf..e325c23d59 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2010 Free Software Foundation Europe e.V. + Copyright (C) 2000-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -598,7 +598,7 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId) jcr->JobFiles++; jcr->FileIndex = file_index; /* remember attribute file_index */ jcr->previous_jr.FileIndex = file_index; - decode_stat(attr, &statf, &LinkFIf); /* decode file stat packet */ + decode_stat(attr, &statf, sizeof(statf), &LinkFIf); /* decode file stat packet */ do_Digest = CRYPTO_DIGEST_NONE; jcr->fn_printed = false; pm_strcpy(jcr->fname, fname); /* move filename into JCR */ @@ -626,7 +626,7 @@ void get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId) Dmsg3(400, "Found %s in catalog. inx=%d Opts=%s\n", jcr->fname, file_index, Opts_Digest); - decode_stat(fdbr.LStat, &statc, &LinkFIc); /* decode catalog stat */ + decode_stat(fdbr.LStat, &statc, sizeof(statc), &LinkFIc); /* decode catalog stat */ /* * Loop over options supplied by user and verify the * fields he requests. diff --git a/bacula/src/filed/accurate.c b/bacula/src/filed/accurate.c index 77866a82d3..2c01bab5ff 100644 --- a/bacula/src/filed/accurate.c +++ b/bacula/src/filed/accurate.c @@ -116,7 +116,7 @@ static bool accurate_send_base_file_list(JCR *jcr) if (elt->seen) { Dmsg2(dbglvl, "base file fname=%s seen=%i\n", elt->fname, elt->seen); /* TODO: skip the decode and use directly the lstat field */ - decode_stat(elt->lstat, &statc, &LinkFIc); /* decode catalog stat */ + decode_stat(elt->lstat, &statc, sizeof(statc), &LinkFIc); /* decode catalog stat */ ff_pkt->fname = elt->fname; ff_pkt->statp = statc; encode_and_send_attributes(jcr, ff_pkt, stream); @@ -158,7 +158,7 @@ static bool accurate_send_deleted_list(JCR *jcr) } Dmsg2(dbglvl, "deleted fname=%s seen=%i\n", elt->fname, elt->seen); /* TODO: skip the decode and use directly the lstat field */ - decode_stat(elt->lstat, &statc, &LinkFIc); /* decode catalog stat */ + decode_stat(elt->lstat, &statc, sizeof(statc), &LinkFIc); /* decode catalog stat */ ff_pkt->fname = elt->fname; ff_pkt->statp.st_mtime = statc.st_mtime; ff_pkt->statp.st_ctime = statc.st_ctime; @@ -283,7 +283,7 @@ bool accurate_check_file(JCR *jcr, FF_PKT *ff_pkt) goto bail_out; } - decode_stat(elt.lstat, &statc, &LinkFIc); /* decode catalog stat */ + decode_stat(elt.lstat, &statc, sizeof(statc), &LinkFIc); /* decode catalog stat */ if (!jcr->rerunning && (jcr->getJobLevel() == L_FULL)) { opts = ff_pkt->BaseJobOpts; diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index 21b1906de1..6ac8721c6d 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -1149,7 +1149,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream) Jmsg0(jcr, M_FATAL, 0, _("Invalid file flags, no supported data stream type.\n")); return false; } - encode_stat(attribs, &ff_pkt->statp, ff_pkt->LinkFI, data_stream); + encode_stat(attribs, &ff_pkt->statp, sizeof(ff_pkt->statp), ff_pkt->LinkFI, data_stream); /** Now possibly extend the attributes */ if (ff_pkt->type == FT_RESTORE_FIRST) { diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index 542ce8490d..ed4d7243ff 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2010 Free Software Foundation Europe e.V. + Copyright (C) 2000-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -341,7 +341,7 @@ void do_restore(JCR *jcr) Dmsg3(100, "=== msglen=%d attrExlen=%d msg=%s\n", sd->msglen, strlen(attr->attrEx), sd->msg); - attr->data_stream = decode_stat(attr->attr, &attr->statp, &attr->LinkFI); + attr->data_stream = decode_stat(attr->attr, &attr->statp, sizeof(attr->statp), &attr->LinkFI); if (!is_restore_stream_supported(attr->data_stream)) { if (!non_support_data++) { diff --git a/bacula/src/filed/verify.c b/bacula/src/filed/verify.c index 237e7718db..8992d7dd0b 100644 --- a/bacula/src/filed/verify.c +++ b/bacula/src/filed/verify.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2010 Free Software Foundation Europe e.V. + Copyright (C) 2000-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -172,7 +172,7 @@ static int verify_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level) } /* Encode attributes and possibly extend them */ - encode_stat(attribs, &ff_pkt->statp, ff_pkt->LinkFI, 0); + encode_stat(attribs, &ff_pkt->statp, sizeof(ff_pkt->statp), ff_pkt->LinkFI, 0); encode_attribsEx(jcr, attribsEx, ff_pkt); jcr->lock(); diff --git a/bacula/src/filed/xattr.c b/bacula/src/filed/xattr.c index eb4ea5d98c..0be8385ec0 100644 --- a/bacula/src/filed/xattr.c +++ b/bacula/src/filed/xattr.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2008-2010 Free Software Foundation Europe e.V. + Copyright (C) 2008-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -2396,7 +2396,7 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n * The current implementation of xattr on Solaris doesn't support this, but if it ever does we are prepared. * Encode the stat struct into an ASCII representation. */ - encode_stat(attribs, &st, 0, stream); + encode_stat(attribs, &st, sizeof(st), 0, stream); cnt = bsnprintf(buffer, sizeof(buffer), "%s%c%s%c%s%c", target_attrname, 0, attribs, 0, (acl_text) ? acl_text : "", 0); break; @@ -2417,7 +2417,7 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n * first real xattr. Encode the stat struct into an ASCII representation and jump * out of the function. */ - encode_stat(attribs, &st, 0, stream); + encode_stat(attribs, &st, sizeof(st), 0, stream); cnt = bsnprintf(buffer, sizeof(buffer), "%s%c%s%c%s%c", target_attrname, 0, attribs, 0, (acl_text) ? acl_text : "", 0); @@ -2429,7 +2429,7 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n * The current implementation of xattr on Solaris doesn't support this, but if it ever does we are prepared. * Encode the stat struct into an ASCII representation. */ - encode_stat(attribs, &st, 0, stream); + encode_stat(attribs, &st, sizeof(st), 0, stream); cnt = bsnprintf(buffer, sizeof(buffer), "%s%c%s%c%s%c", target_attrname, 0, attribs, 0, (acl_text) ? acl_text : "", 0); @@ -2447,7 +2447,7 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n /* * Generate a xattr encoding with the reference to the target in there. */ - encode_stat(attribs, &st, st.st_ino, stream); + encode_stat(attribs, &st, sizeof(st), st.st_ino, stream); cnt = bsnprintf(buffer, sizeof(buffer), "%s%c%s%c%s%c", target_attrname, 0, attribs, 0, xlce->target, 0); @@ -2478,7 +2478,7 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n /* * Encode the stat struct into an ASCII representation. */ - encode_stat(attribs, &st, 0, stream); + encode_stat(attribs, &st, sizeof(st), 0, stream); cnt = bsnprintf(buffer, sizeof(buffer), "%s%c%s%c%s%c", target_attrname, 0, attribs, 0, (acl_text) ? acl_text : "", 0); @@ -2522,7 +2522,7 @@ static bxattr_exit_code solaris_save_xattr(JCR *jcr, int fd, const char *xattr_n /* * Generate a xattr encoding with the reference to the target in there. */ - encode_stat(attribs, &st, st.st_ino, stream); + encode_stat(attribs, &st, sizeof(st), st.st_ino, stream); cnt = bsnprintf(buffer, sizeof(buffer), "%s%c%s%c%s%c", target_attrname, 0, attribs, 0, link_source, 0); @@ -2975,7 +2975,7 @@ static bxattr_exit_code solaris_restore_xattrs(JCR *jcr, bool is_extensible) /* * Decode the attributes from the stream. */ - decode_stat(attribs, &st, &inum); + decode_stat(attribs, &st, sizeof(st), &inum); /* * Decode the next field (acl_text). diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index c1043308e8..419689fd8e 100644 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2002-2010 Free Software Foundation Europe e.V. + Copyright (C) 2002-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -170,10 +170,17 @@ int select_data_stream(FF_PKT *ff_pkt) * them in the encode_attribsEx() subroutine, but this is * not recommended. */ -void encode_stat(char *buf, struct stat *statp, int32_t LinkFI, int data_stream) +void encode_stat(char *buf, struct stat *statp, int stat_size, int32_t LinkFI, int data_stream) { char *p = buf; + /* + * We read the stat packet so make sure the caller's conception + * is the same as ours. They can be different if LARGEFILE is not + * the same when compiling this library and the calling program. + */ + ASSERT(stat_size == (int)sizeof(struct stat)); + /** * Encode a stat packet. I should have done this more intelligently * with a length so that it could be easily expanded. @@ -245,11 +252,18 @@ void encode_stat(char *buf, struct stat *statp, int32_t LinkFI, int data_stream) /** Decode a stat packet from base64 characters */ -int decode_stat(char *buf, struct stat *statp, int32_t *LinkFI) +int decode_stat(char *buf, struct stat *statp, int stat_size, int32_t *LinkFI) { char *p = buf; int64_t val; + /* + * We store into the stat packet so make sure the caller's conception + * is the same as ours. They can be different if LARGEFILE is not + * the same when compiling this library and the calling program. + */ + ASSERT(stat_size == (int)sizeof(struct stat)); + p += from_base64(&val, p); plug(statp->st_dev, val); p++; @@ -330,10 +344,16 @@ int decode_stat(char *buf, struct stat *statp, int32_t *LinkFI) } /** Decode a LinkFI field of encoded stat packet */ -int32_t decode_LinkFI(char *buf, struct stat *statp) +int32_t decode_LinkFI(char *buf, struct stat *statp, int stat_size) { char *p = buf; int64_t val; + /* + * We store into the stat packet so make sure the caller's conception + * is the same as ours. They can be different if LARGEFILE is not + * the same when compiling this library and the calling program. + */ + ASSERT(stat_size == (int)sizeof(struct stat)); skip_nonspaces(&p); /* st_dev */ p++; /* skip space */ diff --git a/bacula/src/findlib/protos.h b/bacula/src/findlib/protos.h index b738b21d6d..fc6fccbdbf 100644 --- a/bacula/src/findlib/protos.h +++ b/bacula/src/findlib/protos.h @@ -32,9 +32,9 @@ */ /* from attribs.c */ -void encode_stat (char *buf, struct stat *statp, int32_t LinkFI, int data_stream); -int decode_stat (char *buf, struct stat *statp, int32_t *LinkFI); -int32_t decode_LinkFI (char *buf, struct stat *statp); +void encode_stat (char *buf, struct stat *statp, int stat_size, int32_t LinkFI, int data_stream); +int decode_stat (char *buf, struct stat *statp, int stat_size, int32_t *LinkFI); +int32_t decode_LinkFI (char *buf, struct stat *statp, int stat_size); int encode_attribsEx (JCR *jcr, char *attribsEx, FF_PKT *ff_pkt); bool set_attributes (JCR *jcr, ATTR *attr, BFILE *ofd); int select_data_stream(FF_PKT *ff_pkt); diff --git a/bacula/src/qt-console/restore/brestore.cpp b/bacula/src/qt-console/restore/brestore.cpp index 8102409327..f1b6b2905d 100644 --- a/bacula/src/qt-console/restore/brestore.cpp +++ b/bacula/src/qt-console/restore/brestore.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2010 Free Software Foundation Europe e.V. + Copyright (C) 2007-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -139,7 +139,7 @@ void bRestore::setJob() Pmsg0(000, "update done\n"); } -extern int decode_stat(char *buf, struct stat *statp, int32_t *LinkFI); +extern int decode_stat(char *buf, struct stat *statp, int stat_size, int32_t *LinkFI); // refresh button with a filter or limit/offset change void bRestore::refreshView() @@ -209,7 +209,7 @@ void bRestore::displayFiles(int64_t pathid, QString path) * Note, the next line zaps variable "item", probably * because the input data in fieldlist is bad. */ - decode_stat(fieldlist.at(4).toLocal8Bit().data(), &statp, &LinkFI); + decode_stat(fieldlist.at(4).toLocal8Bit().data(), &statp, sizeof(statp), &LinkFI); TableItemFormatter item(*FileList, row++); item.setFileType(col++, QString("folder")); // folder or file item.setTextFld(col++, fieldlist.at(5)); // path @@ -233,7 +233,7 @@ void bRestore::displayFiles(int64_t pathid, QString path) TableItemFormatter item(*FileList, row++); item.setTextFld(col++, fieldlist.at(5)); // name decode_stat(fieldlist.at(4).toLocal8Bit().data(), - &statp, &LinkFI); + &statp, sizeof(statp), &LinkFI); item.setBytesFld(col++, QString().setNum(statp.st_size)); item.setDateFld(col++, statp.st_mtime); // keep original info on the first cel that is never empty @@ -290,7 +290,7 @@ void bRestore::displayFileVersion(QString pathid, QString fnid, item.setTextFld(col++, fieldlist.at(6)); // Volume item.setNumericFld(col++, fieldlist.at(3)); // JobId decode_stat(fieldlist.at(4).toLocal8Bit().data(), - &statp, &LinkFI); + &statp, sizeof(statp), &LinkFI); item.setBytesFld(col++, QString().setNum(statp.st_size)); // size item.setDateFld(col++, statp.st_mtime); // date item.setTextFld(col++, fieldlist.at(5)); // chksum @@ -463,7 +463,7 @@ void bRestoreTable::dropEvent(QDropEvent *event) } item.setTextFld(col++, fields.at(5)); // filename decode_stat(fields.at(4).toLocal8Bit().data(), - &statp, &LinkFI); + &statp, sizeof(statp), &LinkFI); item.setBytesFld(col++, QString().setNum(statp.st_size)); // size item.setDateFld(col++, statp.st_mtime); // date item.setNumericFld(col++, fields.at(3)); // jobid @@ -561,7 +561,7 @@ void bRestore::get_info_from_selection(QStringList &fileids, fileids << lst.at(2); jobids << lst.at(3); decode_stat(lst.at(4).toLocal8Bit().data(), - &statp, &LinkFI); + &statp, sizeof(statp), &LinkFI); if (LinkFI) { findexes << lst.at(3) + "," + QString().setNum(LinkFI); } diff --git a/bacula/src/stored/bextract.c b/bacula/src/stored/bextract.c index 286c474c44..2e2a44919d 100644 --- a/bacula/src/stored/bextract.c +++ b/bacula/src/stored/bextract.c @@ -328,7 +328,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) } if (file_is_included(ff, attr->fname) && !file_is_excluded(ff, attr->fname)) { - attr->data_stream = decode_stat(attr->attr, &attr->statp, &attr->LinkFI); + attr->data_stream = decode_stat(attr->attr, &attr->statp, sizeof(attr->statp), &attr->LinkFI); if (!is_restore_stream_supported(attr->data_stream)) { if (!non_support_data++) { Jmsg(jcr, M_ERROR, 0, _("%s stream not supported on this Client.\n"), diff --git a/bacula/src/stored/bls.c b/bacula/src/stored/bls.c index e9758c0e46..a7c396e574 100644 --- a/bacula/src/stored/bls.c +++ b/bacula/src/stored/bls.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2010 Free Software Foundation Europe e.V. + Copyright (C) 2000-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -391,7 +391,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) return true; } - attr->data_stream = decode_stat(attr->attr, &attr->statp, &attr->LinkFI); + attr->data_stream = decode_stat(attr->attr, &attr->statp, sizeof(attr->statp), &attr->LinkFI); build_attr_output_fnames(jcr, attr); if (file_is_included(ff, attr->fname) && !file_is_excluded(ff, attr->fname)) { diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index dd373b9084..0605796019 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2001-2010 Free Software Foundation Europe e.V. + Copyright (C) 2001-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -689,7 +689,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) } if (verbose > 1) { - decode_stat(attr->attr, &attr->statp, &attr->LinkFI); + decode_stat(attr->attr, &attr->statp, sizeof(attr->statp), &attr->LinkFI); build_attr_output_fnames(bjcr, attr); print_ls_output(bjcr, attr); } diff --git a/bacula/src/tools/bvfs_test.c b/bacula/src/tools/bvfs_test.c index 545591c09e..06ecbecab2 100644 --- a/bacula/src/tools/bvfs_test.c +++ b/bacula/src/tools/bvfs_test.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2009-2009 Free Software Foundation Europe e.V. + Copyright (C) 2009-2011 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -79,10 +79,9 @@ static int result_handler(void *ctx, int fields, char **row) memset(&attr->statp, 0, sizeof(struct stat)); decode_stat((row[BVFS_LStat] && row[BVFS_LStat][0])?row[BVFS_LStat]:empty, - &attr->statp, &attr->LinkFI); + &attr->statp, sizeof(attr->statp), &attr->LinkFI); - if (bvfs_is_dir(row) || bvfs_is_file(row)) - { + if (bvfs_is_dir(row) || bvfs_is_file(row)) { /* display clean stuffs */ if (bvfs_is_dir(row)) { -- 2.39.5