]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/patches/testing/blastattributes.patch
ebl fix compilation
[bacula/bacula] / bacula / patches / testing / blastattributes.patch
index f7d302d0119ca853ab3557d0df5b53eec9bcb40b..ce8413a24353db52c7325e91ce01ac4fd11ec213 100644 (file)
@@ -1,6 +1,6 @@
 Index: src/dird/catreq.c
 ===================================================================
---- src/dird/catreq.c  (révision 8261)
+--- src/dird/catreq.c  (révision 8270)
 +++ src/dird/catreq.c  (copie de travail)
 @@ -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  (révision 8270)
 +++ src/dird/getmsg.c  (copie de travail)
 @@ -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,7 +213,7 @@ 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  (révision 8270)
 +++ src/dird/protos.h  (copie de travail)
 @@ -80,6 +80,7 @@
  /* catreq.c */
@@ -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 (révision 8270)
 +++ src/stored/spool.c (copie de travail)
-@@ -622,13 +622,19 @@
+@@ -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 blast_attr_spool_file(JCR *jcr, boffset_t 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"));
++      return false;
++   }
++   
++   if (!bstrcmp(jcr->dir_bsock->msg, "1000 OK BlastAttr\n")) {
++      return false;
++   }
++   return true;
++}
 +
  bool commit_attribute_spool(JCR *jcr)
  {
@@ -247,32 +269,22 @@ 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,13 @@
        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"));
-+         goto bail_out;
-+      }
-+
-+      if (!bstrcmp(jcr->dir_bsock->msg, "1000 OK BlastAttr\n")) {
++      if (!blast_attr_spool_file(jcr, size)) {
++         /* Can't read spool file from director side,
++          * send content over network.
++          */
 +         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 +697,6 @@
     return false;
  }