]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/read.c
- Put Dmsg() on inside if() to avoid calling subroutine.
[bacula/bacula] / bacula / src / stored / read.c
index c91aca91205707c660aefe7291e679842208f22a..cf490ce4903f4add545d181bee559ac65d48ef00 100644 (file)
@@ -6,22 +6,17 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000-2004 Kern Sibbald and John Walker
+   Copyright (C) 2000-2005 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
+   modify it under the terms of the GNU General Public License
+   version 2 as ammended with additional clauses defined in the
+   file LICENSE in the main source directory.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
+   the file LICENSE for additional details.
 
  */
 
@@ -46,11 +41,11 @@ bool do_read_data(JCR *jcr)
 {
    BSOCK *fd = jcr->file_bsock;
    bool ok = true;
-   DCR *dcr;
+   DCR *dcr = jcr->dcr;
 
    Dmsg0(20, "Start read data.\n");
 
-   if (!bnet_set_buffer_size(fd, jcr->device->max_network_buffer_size, BNET_SETBUF_WRITE)) {
+   if (!bnet_set_buffer_size(fd, dcr->device->max_network_buffer_size, BNET_SETBUF_WRITE)) {
       return false;
    }
 
@@ -66,11 +61,10 @@ bool do_read_data(JCR *jcr)
    Dmsg2(200, "Found %d volumes names to restore. First=%s\n", jcr->NumVolumes,
       jcr->VolList->VolumeName);
 
-   /*
-    * Ready device for reading, and read records
-    */
-   if (!(dcr=acquire_device_for_read(jcr))) {
+   /* Ready device for reading */
+   if (!acquire_device_for_read(dcr)) {
       free_vol_list(jcr);
+      bnet_fsend(fd, FD_error);
       return false;
    }
 
@@ -81,7 +75,7 @@ bool do_read_data(JCR *jcr)
    /* Send end of data to FD */
    bnet_sig(fd, BNET_EOD);
 
-   if (!release_device(jcr)) {
+   if (!release_device(dcr)) {
       ok = false;
    }
 
@@ -117,7 +111,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
         bnet_strerror(fd));
       return false;
    } else {
-      Dmsg1(30, ">filed: Hdr=%s\n", fd->msg);
+      Dmsg1(31, ">filed: Hdr=%s\n", fd->msg);
    }
 
 
@@ -125,7 +119,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
    save_msg = fd->msg;         /* save fd message pointer */
    fd->msg = rec->data;        /* pass data directly to bnet_send */
    fd->msglen = rec->data_len;
-   Dmsg1(30, ">filed: send %d bytes data.\n", fd->msglen);
+   Dmsg1(31, ">filed: send %d bytes data.\n", fd->msglen);
    if (!bnet_send(fd)) {
       Pmsg1(000, "Error sending to FD. ERR=%s\n", bnet_strerror(fd));
       Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),