From 43c6238a6b168f263956b1569cf65d071ea952c2 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Fri, 2 Jan 2009 16:24:12 +0000 Subject: [PATCH] ebl cleanup git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8271 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/patches/testing/blastattributes.patch | 65 +++++++++++--------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/bacula/patches/testing/blastattributes.patch b/bacula/patches/testing/blastattributes.patch index f7d302d011..3c475fcfe9 100644 --- a/bacula/patches/testing/blastattributes.patch +++ b/bacula/patches/testing/blastattributes.patch @@ -1,7 +1,7 @@ Index: src/dird/catreq.c =================================================================== ---- src/dird/catreq.c (révision 8261) -+++ src/dird/catreq.c (copie de travail) +--- src/dird/catreq.c (revision 8270) ++++ src/dird/catreq.c (working copy) @@ -356,14 +356,7 @@ return; } @@ -70,7 +70,7 @@ Index: src/dird/catreq.c skip_nonspaces(&p); /* skip FileIndex */ skip_spaces(&p); filetype = str_to_int32(p); /* TODO: choose between unserialize and str_to_int32 */ -@@ -510,8 +490,103 @@ +@@ -510,8 +490,104 @@ } } } @@ -123,6 +123,7 @@ Index: src/dird/catreq.c + + spool_fd = fopen(file, "rb"); + if (!spool_fd) { ++ Dmsg0(0, "cancel despool_attributes_from_file\n"); + /* send an error message */ + goto bail_out; + } @@ -176,14 +177,14 @@ Index: src/dird/catreq.c +} Index: src/dird/getmsg.c =================================================================== ---- src/dird/getmsg.c (révision 8258) -+++ src/dird/getmsg.c (copie de travail) +--- src/dird/getmsg.c (revision 8270) ++++ src/dird/getmsg.c (working copy) @@ -135,7 +135,7 @@ for (;;) { n = bs->recv(); - Dmsg2(300, "bget_dirmsg %d: %s\n", n, bs->msg); -+ Dmsg2(0, "bget_dirmsg %d: %s\n", n, bs->msg); ++ Dmsg2(100, "bget_dirmsg %d: %s\n", n, bs->msg); if (is_bnet_stop(bs)) { return n; /* error or terminate */ @@ -203,7 +204,7 @@ Index: src/dird/getmsg.c + if (despool_attributes_from_file(jcr, filename)) { + bs->fsend("1000 OK BlastAttr\n"); + } else { -+ bs->fsend("3000 ERROR BlastAttr\n"); ++ bs->fsend("1990 ERROR BlastAttr\n"); + } + continue; + } @@ -212,8 +213,8 @@ Index: src/dird/getmsg.c mount_request(jcr, bs, msg); Index: src/dird/protos.h =================================================================== ---- src/dird/protos.h (révision 8258) -+++ src/dird/protos.h (copie de travail) +--- src/dird/protos.h (revision 8270) ++++ src/dird/protos.h (working copy) @@ -80,6 +80,7 @@ /* catreq.c */ extern void catalog_request(JCR *jcr, BSOCK *bs); @@ -224,9 +225,9 @@ Index: src/dird/protos.h extern const char *level_to_str(int level); Index: src/stored/spool.c =================================================================== ---- src/stored/spool.c (révision 8258) -+++ src/stored/spool.c (copie de travail) -@@ -622,13 +622,19 @@ +--- src/stored/spool.c (revision 8270) ++++ src/stored/spool.c (working copy) +@@ -622,13 +622,40 @@ V(mutex); } @@ -235,6 +236,27 @@ Index: src/stored/spool.c + Mmsg(name, "%s/%s.attr.%s.%d.spool", working_directory, my_name, + jcr->Job, fd); +} ++ ++static bool despool_attr_spool_file(JCR *jcr) ++{ ++ /* send full spool file name */ ++ POOLMEM *name = get_pool_memory(PM_MESSAGE); ++ make_unique_spool_filename(jcr, &name, jcr->dir_bsock->m_fd); ++ bash_spaces(name); ++ jcr->dir_bsock->fsend("BlastAttr Job=%s File=%s\n", ++ jcr->Job, name); ++ free_pool_memory(name); ++ ++ if (jcr->dir_bsock->recv() <= 0) { ++ Jmsg(jcr, M_FATAL, 0, _("Network error on BlastAttributes.\n")); ++ return false; ++ } ++ ++ if (!bstrcmp(jcr->dir_bsock->msg, "1000 OK BlastAttr\n")) { ++ jcr->dir_bsock->despool(update_attr_spool_size, size); ++ } ++ return true; ++} + bool commit_attribute_spool(JCR *jcr) { @@ -247,32 +269,19 @@ Index: src/stored/spool.c ( utime_t)time(NULL))); if (are_attributes_spooled(jcr)) { if (fseeko(jcr->dir_bsock->m_spool_fd, 0, SEEK_END) != 0) { -@@ -654,7 +660,23 @@ +@@ -654,7 +681,10 @@ dir_send_job_status(jcr); Jmsg(jcr, M_INFO, 0, _("Sending spooled attrs to the Director. Despooling %s bytes ...\n"), edit_uint64_with_commas(size, ec1)); - jcr->dir_bsock->despool(update_attr_spool_size, size); + -+ /* send full spool file name */ -+ POOLMEM *name = get_pool_memory(PM_MESSAGE); -+ make_unique_spool_filename(jcr, &name, jcr->dir_bsock->m_fd); -+ bash_spaces(name); -+ jcr->dir_bsock->fsend("BlastAttr Job=%s File=%s\n", -+ jcr->Job, name); -+ free_pool_memory(name); -+ -+ if (jcr->dir_bsock->recv() <= 0) { -+ Jmsg(jcr, M_FATAL, 0, _("Network error on BlastAttributes.\n")); ++ if (!despool_attr_spool_file(jcr)) { + goto bail_out; -+ } -+ -+ if (!bstrcmp(jcr->dir_bsock->msg, "1000 OK BlastAttr\n")) { -+ jcr->dir_bsock->despool(update_attr_spool_size, size); + } return close_attr_spool_file(jcr, jcr->dir_bsock); } return true; -@@ -664,13 +686,6 @@ +@@ -664,13 +694,6 @@ return false; } -- 2.39.5