-
-static int send_bootstrap_file(JCR *jcr)
-{
- FILE *bs;
- char buf[1000];
- BSOCK *fd = jcr->file_bsock;
- char *bootstrap = "bootstrap\n";
-
- Dmsg1(400, "send_bootstrap_file: %s\n", jcr->RestoreBootstrap);
- if (!jcr->RestoreBootstrap) {
- return 1;
- }
- bs = fopen(jcr->RestoreBootstrap, "r");
- if (!bs) {
- Jmsg(jcr, M_FATAL, 0, _("Could not open bootstrap file %s: ERR=%s\n"),
- jcr->RestoreBootstrap, strerror(errno));
- jcr->JobStatus = JS_ErrorTerminated;
- return 0;
- }
- strcpy(fd->msg, bootstrap);
- fd->msglen = strlen(fd->msg);
- bnet_send(fd);
- while (fgets(buf, sizeof(buf), bs)) {
- fd->msglen = Mmsg(&fd->msg, "%s", buf);
- bnet_send(fd);
- }
- bnet_sig(fd, BNET_EOD);
- fclose(bs);
- if (!response(fd, OKbootstrap, "Bootstrap")) {
- jcr->JobStatus = JS_ErrorTerminated;
- return 0;
- }
- return 1;
-}