]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix console prompt + apply Nic's file descriptor leak fix
authorKern Sibbald <kern@sibbald.com>
Sun, 7 Sep 2003 17:04:45 +0000 (17:04 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 7 Sep 2003 17:04:45 +0000 (17:04 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@690 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/console/console.c
bacula/src/stored/append.c
bacula/src/version.h

index 19907ae21a9c74d4dd86ed481692cb260becb42c..296cdf036704ab2c3d823fd141c6e9726433695b 100644 (file)
@@ -28,6 +28,8 @@ Testing to do: (painful)
 - Figure out how to use ssh or stunnel to protect Bacula communications.
 
 For 1.32:
+- Add restore by filename test.
+- Add test of exclusion, test multiple Include {} statements.
 - Enhance "update slots" to include a "scan" feature
   scan 1; scan 1-5; scan 1,2,4 ...  to update the catalog 
 - Allow a slot or range of slots on the label barcodes command.
@@ -888,4 +890,3 @@ Done: (see kernsdone for more)
 - Specify list of files to restore
 - Implement ClientRunBeforeJob and ClientRunAfterJob.
 - Make | and < work on FD side.
-
index 8e9849bc93b1f5ae382c3b1d983e16a67db6a2f2..deba1f9c25cb5ec44fd5c2d76797147030e4427c 100644 (file)
@@ -191,7 +191,9 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock)
       if (stat < 0) {
         break;                       /* error */
       } else if (stat == 0) {        /* timeout */
-         bnet_fsend(UA_sock, ".messages");
+        if (at_prompt) {
+            bnet_fsend(UA_sock, ".messages");
+        }
       } else {
         at_prompt = FALSE;
         /* @ => internal command for us */
index 8195769e85dce7279594fcef4be18d4202af60ce..a73ce428c6a9bc16a2c873707ba08b3f63fea3ec 100644 (file)
 /* Responses sent to the File daemon */
 static char OK_data[]    = "3000 OK data\n";
 
+/* Forward referenced functions */
+static bool is_spooled(JCR *jcr);
+static int begin_attribute_spool(JCR *jcr);
+static int discard_attribute_spool(JCR *jcr);
+static int commit_attribute_spool(JCR *jcr);
+
 /* 
  *  Append Data sent from File daemon  
  *
@@ -51,15 +57,14 @@ int do_append_data(JCR *jcr)
    /* Tell File daemon to send data */
    bnet_fsend(fd_sock, OK_data);
 
-   if (!jcr->no_attributes && jcr->spool_attributes) {
-      open_spool_file(jcr, jcr->dir_bsock);
-   }
+   begin_attribute_spool(jcr);
 
    ds = fd_sock;
 
    if (!bnet_set_buffer_size(ds, MAX_NETWORK_BUFFER_SIZE, BNET_SETBUF_WRITE)) {
       set_jcr_job_status(jcr, JS_ErrorTerminated);
       Jmsg(jcr, M_FATAL, 0, _("Unable to set network buffer size.\n"));
+      discard_attribute_spool(jcr);
       return 0;
    }
 
@@ -77,6 +82,7 @@ int do_append_data(JCR *jcr)
    if (!(dev=acquire_device_for_append(jcr, dev, block))) {
       set_jcr_job_status(jcr, JS_ErrorTerminated);
       free_block(block);
+      discard_attribute_spool(jcr);
       return 0;
    }
    Dmsg0(100, "Just after acquire_device_for_append\n");
@@ -205,7 +211,7 @@ int do_append_data(JCR *jcr)
         if (stream == STREAM_UNIX_ATTRIBUTES    || stream == STREAM_MD5_SIGNATURE ||
             stream == STREAM_UNIX_ATTRIBUTES_EX || stream == STREAM_SHA1_SIGNATURE) { 
            if (!jcr->no_attributes) {
-              if (jcr->spool_attributes && jcr->dir_bsock->spool_fd) {
+              if (is_spooled(jcr)) {
                  jcr->dir_bsock->spool = 1;
               }
                Dmsg0(200, "Send attributes.\n");
@@ -267,13 +273,43 @@ int do_append_data(JCR *jcr)
 
    free_block(block);
 
-   if (jcr->spool_attributes && jcr->dir_bsock->spool_fd) {
-      bnet_despool(jcr->dir_bsock);
-      close_spool_file(jcr, jcr->dir_bsock);
-   }
+   commit_attribute_spool(jcr);
 
    dir_send_job_status(jcr);         /* update director */
 
    Dmsg1(100, "return from do_append_data() stat=%d\n", ok);
    return ok ? 1 : 0;
 }
+
+static bool is_spooled(JCR *jcr)
+{
+   if (jcr->spool_attributes && jcr->dir_bsock->spool_fd) {
+      return true;
+   }
+   return false;
+}
+
+static int begin_attribute_spool(JCR *jcr)
+{
+   if (!jcr->no_attributes && jcr->spool_attributes) {
+      return 0;
+   }
+   return open_spool_file(jcr, jcr->dir_bsock);
+}
+
+static int discard_attribute_spool(JCR *jcr)
+{
+   if (!is_spooled(jcr)) {
+      return 0;
+   }
+   return close_spool_file(jcr, jcr->dir_bsock);
+}
+
+static int commit_attribute_spool(JCR *jcr)
+{
+   if (!is_spooled(jcr)) {
+      return 0;
+   }
+   bnet_despool(jcr->dir_bsock);
+   return close_spool_file(jcr, jcr->dir_bsock);
+}
index 0f34138c30fc26406c197d73a4a4478734db05d5..809c094d633a89c5ab0b1760e711d036f8efce2a 100644 (file)
@@ -2,8 +2,8 @@
 #undef  VERSION
 #define VERSION "1.32"
 #define VSTRING "1"
-#define BDATE   "06 Sep 2003"
-#define LSMDATE "06Sep03"
+#define BDATE   "07 Sep 2003"
+#define LSMDATE "07Sep03"
 
 /* Debug flags */
 #undef  DEBUG