src/filed/job.c
int response(JCR *jcr, BSOCK *sd, char *resp, const char *cmd)
{
   int ret;

   if (sd->errors) {
      return 0;
   }
   if ((ret = bget_msg(sd)) > 0) {
      Dmsg0(110, sd->msg);
      if (strcmp(sd->msg, resp) == 0) {
         return 1;
      }
   }
   if (job_canceled(jcr)) {
      return 0;                       /* if canceled avoid useless error messages */
   }
   if (sd->is_error()) {
      Jmsg2(jcr, M_FATAL, 0, _("Comm error with SD. bad response to %s. ERR=%s\n"),
         cmd, sd->bstrerror());
   } else {
      char buf[256];
      if (ret > 0) {
         Jmsg4(jcr, M_FATAL, 0, _("Bad response from SD to %s command. Wanted %s, got len=%ld msg=\"%s\"\n"),
            cmd, resp, sd->msglen, smartdump(sd->msg, sd->msglen, buf, sizeof(buf)));
      } else {
         Jmsg3(jcr, M_FATAL, 0, _("Bad response from SD to %s command. Wanted %s, got SIGNAL %s\n"),
            cmd, resp, bnet_sig_to_ascii(ret));
      }
   }
   return 0;
}
/**
 * Get response from Storage daemon to a command we
 * sent. Check that the response is OK.
 *
 *  Returns: 0 on failure
 *           1 on success
 */
Get response from Storage daemon to a command we
sent. Check that the response is OK.

0 on failure
1 on success
Get response from Storage daemon to a command we sent . Check that the response is OK . 0 on failure 1 on success
int response(JCR *jcr, BSOCK *sd, char *resp, const char *cmd)
{
   int ret;
   if (sd->errors) {
      return 0;
   }
   if ((ret = bget_msg(sd)) > 0) {
      Dmsg0(110, sd->msg);
      if (strcmp(sd->msg, resp) == 0) {
         return 1;
      }
   }
   if (job_canceled(jcr)) {
      return 0;                       
   }
   if (sd->is_error()) {
      Jmsg2(jcr, M_FATAL, 0, _("Comm error with SD. bad response to %s. ERR=%s\n"),
         cmd, sd->bstrerror());
   } else {
      char buf[256];
      if (ret > 0) {
         Jmsg4(jcr, M_FATAL, 0, _("Bad response from SD to %s command. Wanted %s, got len=%ld msg=\"%s\"\n"),
            cmd, resp, sd->msglen, smartdump(sd->msg, sd->msglen, buf, sizeof(buf)));
      } else {
         Jmsg3(jcr, M_FATAL, 0, _("Bad response from SD to %s command. Wanted %s, got SIGNAL %s\n"),
            cmd, resp, bnet_sig_to_ascii(ret));
      }
   }
   return 0;
}
int response ( JCR * jcr , BSOCK * sd , char * resp , const char * cmd ) { int ret ; if ( sd -> errors ) { return 0 ; } if ( ( ret = bget_msg ( sd ) ) > 0 ) { Dmsg0 ( 110 , sd -> msg ) ; if ( strcmp ( sd -> msg , resp ) == 0 ) { return 1 ; } } if ( job_canceled ( jcr ) ) { return 0 ; } if ( sd -> is_error ( ) ) { Jmsg2 ( jcr , M_FATAL , 0 , _ ( " \n " ) , cmd , sd -> bstrerror ( ) ) ; } else { char buf [ 256 ] ; if ( ret > 0 ) { Jmsg4 ( jcr , M_FATAL , 0 , _ ( " \" \" \n " ) , cmd , resp , sd -> msglen , smartdump ( sd -> msg , sd -> msglen , buf , sizeof ( buf ) ) ) ; } else { Jmsg3 ( jcr , M_FATAL , 0 , _ ( " \n " ) , cmd , resp , bnet_sig_to_ascii ( ret ) ) ; } } return 0 ; }
Get response from Storage daemon to a command we
 sent.
Get response from Storage daemon to a command we sent .
/* if canceled avoid useless error messages */