]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/fd_cmds.c
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / stored / fd_cmds.c
index aca7e3c0d497570f14686de35083f9ff6e3ec50f..0387f2399eb7e30bc050ef7d3f08d296cd070cd4 100644 (file)
@@ -13,7 +13,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2006 Kern Sibbald
+   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
@@ -53,10 +53,9 @@ static bool append_end_session(JCR *jcr);
 static bool read_open_session(JCR *jcr);
 static bool read_data_cmd(JCR *jcr);
 static bool read_close_session(JCR *jcr);
-static bool bootstrap_cmd(JCR *jcr);
 
 /* Exported function */
-bool get_bootstrap_file(JCR *jcr, BSOCK *bs);
+bool bootstrap_cmd(JCR *jcr);
 
 struct s_cmds {
    const char *cmd;
@@ -94,7 +93,7 @@ static char ERROR_bootstrap[] = "3904 Error bootstrap\n";
 
 /* Information sent to the Director */
 static char Job_start[] = "3010 Job %s start\n";
-char Job_end[]   =
+static char Job_end[]   =
    "3099 Job %s end JobStatus=%d JobFiles=%d JobBytes=%s\n";
 
 /*
@@ -138,7 +137,7 @@ void run_job(JCR *jcr)
       for (i=0; fd_cmds[i].cmd; i++) {
          if (strncmp(fd_cmds[i].cmd, fd->msg, strlen(fd_cmds[i].cmd)) == 0) {
             found = true;               /* indicate command found */
-            if (!fd_cmds[i].func(jcr)) {    /* do command */
+            if (!fd_cmds[i].func(jcr) || job_canceled(jcr)) { /* do command */
                set_jcr_job_status(jcr, JS_ErrorTerminated);
                quit = true;
             }
@@ -310,13 +309,9 @@ static bool read_open_session(JCR *jcr)
    return true;
 }
 
-static bool bootstrap_cmd(JCR *jcr)
-{
-   return get_bootstrap_file(jcr, jcr->file_bsock);
-}
-
-bool get_bootstrap_file(JCR *jcr, BSOCK *sock)
+bool bootstrap_cmd(JCR *jcr)
 {
+   BSOCK *fd = jcr->file_bsock;
    POOLMEM *fname = get_pool_memory(PM_FNAME);
    FILE *bs;
    bool ok = false;
@@ -335,9 +330,9 @@ bool get_bootstrap_file(JCR *jcr, BSOCK *sock)
          jcr->RestoreBootstrap, strerror(errno));
       goto bail_out;
    }
-   while (bnet_recv(sock) >= 0) {
-       Dmsg1(400, "stored<filed: bootstrap file %s", sock->msg);
-       fputs(sock->msg, bs);
+   while (bnet_recv(fd) >= 0) {
+       Dmsg1(400, "stored<filed: bootstrap file %s", fd->msg);
+       fputs(fd->msg, bs);
    }
    fclose(bs);
    jcr->bsr = parse_bsr(jcr, jcr->RestoreBootstrap);
@@ -355,10 +350,10 @@ bail_out:
    free_pool_memory(jcr->RestoreBootstrap);
    jcr->RestoreBootstrap = NULL;
    if (!ok) {
-      bnet_fsend(sock, ERROR_bootstrap);
+      bnet_fsend(fd, ERROR_bootstrap);
       return false;
    }
-   return bnet_fsend(sock, OK_bootstrap);
+   return bnet_fsend(fd, OK_bootstrap);
 }