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;
}
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 @@
}
}
}
+
+ spool_fd = fopen(file, "rb");
+ if (!spool_fd) {
++ Dmsg0(0, "cancel despool_attributes_from_file\n");
+ /* send an error message */
+ goto bail_out;
+ }
+}
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 */
+ 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;
+ }
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);
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);
}
+ 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)
{
( 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;
}