static int prepare_buffer(int argc, char * argv[]) { if (argc<2) { usage(); return -1; } if (strncmp(argv[1],"mount",5)==0) { return do_mount(argc,argv); } else if (strncmp(argv[1],"resume",6)==0) { return do_resume(argc,argv); } else if (strncmp(argv[1],"suspend",7)==0) { return do_suspend(argc,argv); } else if (strncmp(argv[1],"status",6)==0) { return do_status(argc,argv); } else if (strncmp(argv[1],"unmount",7)==0) { return do_unmount(argc,argv); } else if (strncmp(argv[1],"exit",4)==0) { return do_exit(argc,argv); } else { usage(); return -1; } return 0; }
static void resume(struct ao *ao) { struct priv *priv = ao->priv; SDL_LockMutex(priv->buffer_mutex); int free = av_fifo_space(priv->buffer); SDL_UnlockMutex(priv->buffer_mutex); if (free) priv->unpause = 1; else do_resume(ao); }
static int play(struct ao *ao, void *data, int len, int flags) { struct priv *priv = ao->priv; SDL_LockMutex(priv->buffer_mutex); int free = av_fifo_space(priv->buffer); if (len > free) len = free; av_fifo_generic_write(priv->buffer, data, len, NULL); SDL_CondSignal(priv->underrun_cond); SDL_UnlockMutex(priv->buffer_mutex); if (priv->unpause) { priv->unpause = 0; do_resume(ao); } return len; }
void Manager::update(float dt) { for (System *system : systems) { //pause all but input and pause systems if (paused == true && (system->get_name() != "OIS_Input_System" && system->get_name() != "Pause_System")) { continue; } system->update(dt); } if (will_resume == true) { do_resume(); } }
int lakemont_resume(struct target *t, int current, uint32_t address, int handle_breakpoints, int debug_execution) { struct breakpoint *bp = NULL; struct x86_32_common *x86_32 = target_to_x86_32(t); if (check_not_halted(t)) return ERROR_TARGET_NOT_HALTED; /* TODO lakemont_enable_breakpoints(t); */ if (t->state == TARGET_HALTED) { /* running away for a software breakpoint needs some special handling */ uint32_t eip = buf_get_u32(x86_32->cache->reg_list[EIP].value, 0, 32); bp = breakpoint_find(t, eip); if (bp != NULL /*&& bp->type == BKPT_SOFT*/) { /* the step will step over the breakpoint */ if (lakemont_step(t, 0, 0, 1) != ERROR_OK) { LOG_ERROR("%s stepping over a software breakpoint at 0x%08" PRIx32 " " "failed to resume the target", __func__, eip); return ERROR_FAIL; } } /* if breakpoints are enabled, we need to redirect these into probe mode */ struct breakpoint *activeswbp = t->breakpoints; while (activeswbp != NULL && activeswbp->set == 0) activeswbp = activeswbp->next; struct watchpoint *activehwbp = t->watchpoints; while (activehwbp != NULL && activehwbp->set == 0) activehwbp = activehwbp->next; if (activeswbp != NULL || activehwbp != NULL) buf_set_u32(x86_32->cache->reg_list[PMCR].value, 0, 32, 1); if (do_resume(t) != ERROR_OK) return ERROR_FAIL; } else { LOG_USER("target not halted"); return ERROR_FAIL; } return ERROR_OK; }
static #endif int do_backup_phase2_server_protocol2(struct async *as, struct asfd *chfd, struct sdirs *sdirs, int resume, struct conf **confs) { int ret=-1; uint8_t end_flags=0; struct slist *slist=NULL; struct iobuf wbuf; struct dpth *dpth=NULL; man_off_t *p1pos=NULL; struct manios *manios=NULL; // This is used to tell the client that a number of consecutive blocks // have been found and can be freed. uint64_t wrap_up=0; struct asfd *asfd=NULL; struct cntr *cntr=NULL; struct sbuf *csb=NULL; uint64_t file_no=1; if(!as) { logp("async not provided to %s()\n", __func__); goto end; } if(!sdirs) { logp("sdirs not provided to %s()\n", __func__); goto end; } if(!confs) { logp("confs not provided to %s()\n", __func__); goto end; } asfd=as->asfd; if(!asfd) { logp("asfd not provided to %s()\n", __func__); goto end; } if(!chfd) { logp("chfd not provided to %s()\n", __func__); goto end; } cntr=get_cntr(confs); if(get_int(confs[OPT_BREAKPOINT])>=2000 && get_int(confs[OPT_BREAKPOINT])<3000) { breaking=get_int(confs[OPT_BREAKPOINT]); breakcount=breaking-2000; } logp("Phase 2 begin (recv backup data)\n"); if(!(dpth=dpth_alloc()) || dpth_protocol2_init(dpth, sdirs->data, get_string(confs[OPT_CNAME]), sdirs->cfiles, get_int(confs[OPT_MAX_STORAGE_SUBDIRS]))) goto end; if(resume && !(p1pos=do_resume(sdirs, dpth, confs))) goto end; if(!(manios=manios_open_phase2(sdirs, p1pos, PROTO_2)) || !(slist=slist_alloc()) || !(csb=sbuf_alloc(PROTO_2))) goto end; iobuf_free_content(asfd->rbuf); memset(&wbuf, 0, sizeof(struct iobuf)); while(!(end_flags&END_BACKUP)) { if(maybe_add_from_scan(manios, slist, chfd, &csb)) goto end; if(!wbuf.len) { if(get_wbuf_from_sigs(&wbuf, slist, &end_flags)) goto end; if(!wbuf.len) { get_wbuf_from_files(&wbuf, slist, manios, &end_flags, &file_no); } } if(wbuf.len && asfd->append_all_to_write_buffer(asfd, &wbuf)==APPEND_ERROR) goto end; if(append_for_champ_chooser(chfd, slist->blist, end_flags)) goto end; if(as->read_write(as)) { logp("error from as->read_write in %s\n", __func__); goto end; } while(asfd->rbuf->buf) { if(deal_with_read(asfd->rbuf, slist, cntr, &end_flags, dpth)) goto end; // Get as much out of the readbuf as possible. if(asfd->parse_readbuf(asfd)) goto end; } while(chfd->rbuf->buf) { if(deal_with_read_from_chfd(chfd, slist->blist, &wrap_up, dpth, cntr)) goto end; // Get as much out of the readbuf as possible. if(chfd->parse_readbuf(chfd)) goto end; } if(write_to_changed_file(asfd, chfd, manios, slist, end_flags)) goto end; } // Hack: If there are some entries left after the last entry that // contains block data, it will not be written to the changed file // yet because the last entry of block data has not had // sb->protocol2->bend set. if(slist->head && slist->head->next) { struct sbuf *sb=NULL; sb=slist->head; slist->head=sb->next; sbuf_free(&sb); if(write_to_changed_file(asfd, chfd, manios, slist, end_flags)) goto end; } if(manios_close(&manios)) goto end; if(check_for_missing_work_in_slist(slist)) goto end; // Need to release the last left. There should be one at most. if(dpth->head && dpth->head->next) { logp("ERROR: More data locks remaining after: %s\n", dpth->head->save_path); goto end; } if(dpth_release_all(dpth)) goto end; ret=0; end: logp("End backup\n"); sbuf_free(&csb); slist_free(&slist); if(asfd) iobuf_free_content(asfd->rbuf); if(chfd) iobuf_free_content(chfd->rbuf); dpth_free(&dpth); manios_close(&manios); man_off_t_free(&p1pos); return ret; }
int backup_phase2_server_protocol1(struct async *as, struct sdirs *sdirs, const char *incexc, int resume, struct conf **cconfs) { int ret=0; struct manio *p1manio=NULL; struct dpth *dpth=NULL; char *deltmppath=NULL; char *last_requested=NULL; // Where to write changed data. // Data is not getting written to a compressed file. // This is important for recovery if the power goes. struct fzp *chfp=NULL; struct fzp *ucfp=NULL; // unchanged data struct fzp *cmanfp=NULL; // previous (current) manifest. struct sbuf *cb=NULL; // file list in current manifest struct sbuf *p1b=NULL; // file list from client struct sbuf *rb=NULL; // receiving file from client struct asfd *asfd=as->asfd; int breaking=0; int breakcount=0; if(get_int(cconfs[OPT_BREAKPOINT])>=2000 && get_int(cconfs[OPT_BREAKPOINT])<3000) { breaking=get_int(cconfs[OPT_BREAKPOINT]); breakcount=breaking-2000; } logp("Begin phase2 (receive file data)\n"); if(!(dpth=dpth_alloc()) || dpth_protocol1_init(dpth, sdirs->currentdata, get_int(cconfs[OPT_MAX_STORAGE_SUBDIRS]))) goto error; if(open_previous_manifest(&cmanfp, sdirs, incexc, cconfs)) goto error; if(get_int(cconfs[OPT_DIRECTORY_TREE])) { // Need to make sure we do not try to create a path that is // too long. if(build_path_w(sdirs->treepath)) goto error; treepathlen=strlen(sdirs->treepath); init_fs_max(sdirs->treepath); } if(!(p1manio=manio_alloc()) || manio_init_read(p1manio, sdirs->phase1data) || !(cb=sbuf_alloc(cconfs)) || !(p1b=sbuf_alloc(cconfs)) || !(rb=sbuf_alloc(cconfs))) goto error; manio_set_protocol(p1manio, PROTO_1); if(resume && do_resume(p1manio, sdirs, dpth, cconfs)) goto error; // Unchanged and changed should now be truncated correctly, we just // have to open them for appending. if(!(ucfp=fzp_open(sdirs->unchanged, "a+b")) || !(chfp=fzp_open(sdirs->changed, "a+b"))) goto error; if(manio_closed(p1manio) && manio_open_next_fpath(p1manio)) goto error; while(1) { if(breaking) { if(breakcount--==0) return breakpoint(cconfs, __func__); } //printf("in loop, %s %s %c\n", // cmanfp?"got cmanfp":"no cmanfp", // rb->path.buf?:"no rb->path", // rb->path.buf?'X':rb->path.cmd); if(write_status(CNTR_STATUS_BACKUP, rb->path.buf?rb->path.buf:p1b->path.buf, cconfs)) goto error; if(last_requested || manio_closed(p1manio) || asfd->writebuflen) { switch(do_stuff_to_receive(asfd, sdirs, cconfs, rb, chfp, dpth, &last_requested)) { case 0: break; case 1: goto end; // Finished ok. case -1: goto error; } } switch(do_stuff_to_send(asfd, p1b, &last_requested)) { case 0: break; case 1: continue; case -1: goto error; } if(manio_closed(p1manio)) continue; sbuf_free_content(p1b); switch(manio_sbuf_fill_phase1(p1manio, asfd, p1b, NULL, sdirs, cconfs)) { case 0: break; case 1: manio_close(p1manio); if(asfd->write_str(asfd, CMD_GEN, "backupphase2end")) goto error; break; case -1: goto error; } if(!cmanfp) { // No old manifest, need to ask for a new file. if(process_new(sdirs, cconfs, p1b, ucfp)) goto error; continue; } // Have an old manifest, look for it there. // Might already have it, or be ahead in the old // manifest. if(cb->path.buf) switch(maybe_process_file(asfd, sdirs, cb, p1b, ucfp, cconfs)) { case 0: break; case 1: continue; case -1: goto error; } while(cmanfp) { sbuf_free_content(cb); switch(sbufl_fill(cb, asfd, cmanfp, cconfs)) { case 0: break; case 1: fzp_close(&cmanfp); if(process_new(sdirs, cconfs, p1b, ucfp)) goto error; continue; case -1: goto error; } switch(maybe_process_file(asfd, sdirs, cb, p1b, ucfp, cconfs)) { case 0: continue; case 1: break; case -1: goto error; } break; } } error: ret=-1; end: if(fzp_close(&chfp)) { logp("error closing %s in %s\n", sdirs->changed, __func__); ret=-1; } if(fzp_close(&ucfp)) { logp("error closing %s in %s\n", sdirs->unchanged, __func__); ret=-1; } free_w(&deltmppath); sbuf_free(&cb); sbuf_free(&p1b); sbuf_free(&rb); manio_free(&p1manio); fzp_close(&cmanfp); dpth_free(&dpth); if(!ret) unlink(sdirs->phase1data); logp("End phase2 (receive file data)\n"); return ret; }
int main(int argc, char *argv[]) { char **cmdv, **args; char *cmdlines[3]; int i; const char *errmsg; int ret = 0; int cmdc; int fd; struct timeval now; char *mount_argv[] = {"mount_part", "rootfs", "/root"}; pid_t pid; int nandboot = 0; gettimeofday(&now, NULL); srand48(now.tv_usec ^ (now.tv_sec << 24)); /* Default parameters for anything init-like we execute */ init_argc = argc; init_argv = alloca((argc+1)*sizeof(char *)); memcpy(init_argv, argv, (argc+1)*sizeof(char *)); /* * omit /dev/console when generating initramfs, * so we create it dynamically */ if (access("/dev/console", O_RDWR)) { mknod("/dev/console", S_IFCHR|0644, makedev(5, 1)); } if ((fd = open("/dev/console", O_RDWR)) != -1) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > STDERR_FILENO) { close(fd); } } mnt_procfs = mount_sys_fs("/proc/cmdline", "/proc", "proc") >= 0; if (!mnt_procfs) { ret = 1; goto bail; } mnt_sysfs = mount_sys_fs("/sys/bus", "/sys", "sysfs") >= 0; if (!mnt_sysfs) { ret = 1; goto bail; } /* Construct the effective kernel command line. The effective kernel command line consists of /arch.cmd, if it exists, /proc/cmdline, plus any arguments after an -- argument on the proper command line, in that order. */ ret = readfile("/arch.cmd", &cmdlines[0]); if (ret < 0) cmdlines[0] = ""; ret = readfile("/proc/cmdline", &cmdlines[1]); if (ret < 0) { fprintf(stderr, "%s: cannot read /proc/cmdline\n", progname); ret = 1; goto bail; } cmdlines[2] = NULL; /* Find an -- argument, and if so append to the command line */ for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "--")) { i++; break; } } args = &argv[i]; /* Points either to first argument past -- or to the final NULL */ /* Count the number of arguments */ cmdc = split_cmdline(INT_MAX, NULL, argv[0], cmdlines, args); /* Actually generate the cmdline array */ cmdv = (char **)alloca((cmdc+1)*sizeof(char *)); if (split_cmdline(cmdc, cmdv, argv[0], cmdlines, args) != cmdc) { ret = 1; goto bail; } /* Debugging... */ dump_args(cmdc, cmdv); { const char * root_device_name = get_arg(cmdc, cmdv, "root="); if (strncmp(root_device_name, "/dev/mtdblock", strlen("/dev/mtdblock")) == 0) { nandboot = 1; printf("kinit: NAND mode, check online upgrade flag\n"); do_rootfs_OU(); } else { nandboot = 0; printf("kinit: None-NAND mode, ignore online upgrade flag\n"); } } /* Resume from suspend-to-disk, if appropriate */ /* If successful, does not return */ do_resume(cmdc, cmdv); /* Initialize networking, if applicable */ do_ipconfig(cmdc, cmdv); check_path("/root"); if (nandboot) { int index = 0; while (1) { char name[128]; snprintf(name, sizeof(name), "/sys/block/mtdblock%d", index); if (access(name, F_OK) == 0) { snprintf(name, sizeof(name), "/dev/mtdblock%d", index); create_dev(name, name_to_dev_t(name)); index++; } else { break; } } if((pid=fork())<0) fprintf(stderr, "fork error.\n"); else if(pid == 0) { if((ret = execve("/bin/mount_part", mount_argv, NULL)) <0) perror("excute mount_part error\n"); } if(waitpid(pid, NULL, 0) < 0) fprintf(stderr, "wait mount_part error.\n"); } else { do_mounts(cmdc, cmdv); } if (mnt_procfs) { umount2("/proc", 0); mnt_procfs = 0; } if (mnt_sysfs) { umount2("/sys", 0); mnt_sysfs = 0; } make_devices(); init_path = find_init("/root", get_arg(cmdc, cmdv, "init=")); if (!init_path) { fprintf(stderr, "%s: init not found!\n", progname); ret = 2; goto bail; } DEBUG(("kinit: init_path = %s, init=%s\n", init_path, get_arg(cmdc, cmdv, "init="))); init_argv[0] = strrchr(init_path, '/') + 1; errmsg = run_init("/root", "/dev/console", init_path, init_argv); /* If run_init returned, something went bad */ fprintf(stderr, "%s: %s: %s\n", progname, errmsg, strerror(errno)); ret = 2; goto bail; bail: if (mnt_procfs) umount2("/proc", 0); if (mnt_sysfs) umount2("/sys", 0); /* * If we get here, something bad probably happened, and the kernel * will most likely panic. Drain console output so the user can * figure out what happened. */ tcdrain(2); tcdrain(1); return ret; }
int backup_phase2_server(gzFile *cmanfp, const char *phase1data, const char *phase2data, const char *unchangeddata, const char *datadirtmp, struct dpth *dpth, const char *currentdata, const char *working, const char *client, struct cntr *p1cntr, int resume, struct cntr *cntr, struct config *cconf) { int ars=0; int ret=0; gzFile p1zp=NULL; char *deltmppath=NULL; char *last_requested=NULL; // Where to write phase2data. // Data is not getting written to a compressed file. // This is important for recovery if the power goes. FILE *p2fp=NULL; // unchanged data FILE *ucfp=NULL; int resume_partial=resume; struct sbuf cb; // file list in current manifest struct sbuf p1b; // file list from client struct sbuf rb; // receiving file from client init_sbuf(&cb); init_sbuf(&p1b); init_sbuf(&rb); if(!(p1zp=gzopen_file(phase1data, "rb"))) goto error; // Open in read+write mode, so that they can be read through if // we need to resume. // First, open them in a+ mode, so that they will be created if they // do not exist. if(!(ucfp=open_file(unchangeddata, "a+b"))) goto error; if(!(p2fp=open_file(phase2data, "a+b"))) goto error; close_fp(&ucfp); close_fp(&p2fp); if(!(ucfp=open_file(unchangeddata, "r+b"))) goto error; if(!(p2fp=open_file(phase2data, "r+b"))) goto error; if(resume && do_resume(p1zp, p2fp, ucfp, dpth, cconf, client, p1cntr, cntr)) goto error; logp("Begin phase2 (receive file data)\n"); if(!(deltmppath=prepend_s(working, "delta.tmp", strlen("delta.tmp")))) goto error; while(1) { int sts=0; // logp("in loop, %s %s %c\n", // *cmanfp?"got cmanfp":"no cmanfp", // rb.path?:"no rb.path", rb.path?'X':rb.cmd); if(rb.path) write_status(client, STATUS_BACKUP, rb.path, p1cntr, cntr); else write_status(client, STATUS_BACKUP, p1b.path, p1cntr, cntr); if((last_requested || !p1zp || writebuflen) && (ars=do_stuff_to_receive(&rb, p2fp, datadirtmp, dpth, working, &last_requested, deltmppath, cntr, cconf))) { if(ars<0) goto error; // 1 means ok. break; } if((sts=do_stuff_to_send(&p1b, &last_requested))<0) goto error; if(!sts && p1zp) { free_sbuf(&p1b); if((ars=sbuf_fill_phase1(NULL, p1zp, &p1b, cntr))) { if(ars<0) goto error; // ars==1 means it ended ok. gzclose_fp(&p1zp); //logp("ended OK - write phase2end"); if(async_write_str(CMD_GEN, "backupphase2end")) goto error; } //logp("check: %s\n", p1b.path); if(!*cmanfp) { // No old manifest, need to ask for a new file. //logp("no cmanfp\n"); if(process_new(&p1b, ucfp, currentdata, datadirtmp, deltmppath, dpth, &resume_partial, cntr, cconf)) goto error; } else { // Have an old manifest, look for it there. // Might already have it, or be ahead in the old // manifest. if(cb.path) { if((ars=maybe_process_file(&cb, &p1b, ucfp, currentdata, datadirtmp, deltmppath, dpth, &resume_partial, cntr, cconf))) { if(ars<0) goto error; // Do not free it - need to send stuff. continue; } //free_sbuf(&p1b); } while(*cmanfp) { free_sbuf(&cb); if((ars=sbuf_fill(NULL, *cmanfp, &cb, cntr))) { // ars==1 means it ended ok. if(ars<0) goto error; gzclose_fp(cmanfp); //logp("ran out of current manifest\n"); if(process_new(&p1b, ucfp, currentdata, datadirtmp, deltmppath, dpth, &resume_partial, cntr, cconf)) goto error; break; } //logp("against: %s\n", cb.path); if((ars=maybe_process_file(&cb, &p1b, ucfp, currentdata, datadirtmp, deltmppath, dpth, &resume_partial, cntr, cconf))) { if(ars<0) goto error; // Do not free it - need to send stuff. break; } } } } } goto end; error: ret=-1; end: if(close_fp(&p2fp)) { logp("error closing %s in backup_phase2_server\n", phase2data); ret=-1; } if(close_fp(&ucfp)) { logp("error closing %s in backup_phase2_server\n", unchangeddata); ret=-1; } free(deltmppath); free_sbuf(&cb); free_sbuf(&p1b); free_sbuf(&rb); gzclose_fp(&p1zp); if(!ret) unlink(phase1data); logp("End phase2 (receive file data)\n"); return ret; }
int backup_phase2_server(struct asfd *asfd, struct sdirs *sdirs, struct conf *cconf, gzFile *cmanfp, struct dpthl *dpthl, int resume) { int ars=0; int ret=0; gzFile p1zp=NULL; char *deltmppath=NULL; char *last_requested=NULL; // Where to write phase2data. // Data is not getting written to a compressed file. // This is important for recovery if the power goes. FILE *p2fp=NULL; // unchanged data FILE *ucfp=NULL; struct sbuf *cb=NULL; // file list in current manifest struct sbuf *p1b=NULL; // file list from client struct sbuf *rb=NULL; // receiving file from client if(!(cb=sbuf_alloc(cconf)) || !(p1b=sbuf_alloc(cconf)) || !(rb=sbuf_alloc(cconf))) goto error; if(!(p1zp=gzopen_file(sdirs->phase1data, "rb"))) goto error; // Open in read+write mode, so that they can be read through if // we need to resume. // First, open them in a+ mode, so that they will be created if they // do not exist. if(!(ucfp=open_file(sdirs->unchangeddata, "a+b")) || !(p2fp=open_file(sdirs->phase2data, "a+b"))) goto error; close_fp(&ucfp); close_fp(&p2fp); if(!(ucfp=open_file(sdirs->unchangeddata, "r+b")) || !(p2fp=open_file(sdirs->phase2data, "r+b"))) goto error; if(resume && do_resume(p1zp, p2fp, ucfp, dpthl, cconf)) goto error; logp("Begin phase2 (receive file data)\n"); while(1) { int sts=0; //printf("in loop, %s %s %c\n", // *cmanfp?"got cmanfp":"no cmanfp", // rb->path.buf?:"no rb->path", // rb->path.buf?'X':rb->path.cmd); if(write_status(STATUS_BACKUP, rb->path.buf?rb->path.buf:p1b->path.buf, cconf)) goto error; if((last_requested || !p1zp || asfd->writebuflen) && (ars=do_stuff_to_receive(asfd, sdirs, cconf, rb, p2fp, dpthl, &last_requested))) { if(ars<0) goto error; // 1 means ok. break; } if((sts=do_stuff_to_send(asfd, p1b, &last_requested))<0) goto error; if(!sts && p1zp) { sbuf_free_content(p1b); if((ars=sbufl_fill_phase1(p1b, NULL, p1zp, cconf->cntr))) { if(ars<0) goto error; // ars==1 means it ended ok. gzclose_fp(&p1zp); //logp("ended OK - write phase2end"); if(asfd->write_str(asfd, CMD_GEN, "backupphase2end")) goto error; } //logp("check: %s\n", p1b.path); if(!*cmanfp) { // No old manifest, need to ask for a new file. //logp("no cmanfp\n"); if(process_new(sdirs, cconf, p1b, ucfp, dpthl)) goto error; } else { // Have an old manifest, look for it there. // Might already have it, or be ahead in the old // manifest. if(cb->path.buf) { if((ars=maybe_process_file(asfd, sdirs, cconf, cb, p1b, ucfp, dpthl))) { if(ars<0) goto error; // Do not free it - need to send stuff. continue; } //free_sbufl(&p1b); } while(*cmanfp) { sbuf_free_content(cb); if((ars=sbufl_fill(cb, asfd, NULL, *cmanfp, cconf->cntr))) { // ars==1 means it ended ok. if(ars<0) goto error; gzclose_fp(cmanfp); //logp("ran out of current manifest\n"); if(process_new(sdirs, cconf, p1b, ucfp, dpthl)) goto error; break; } //logp("against: %s\n", cb.path); if((ars=maybe_process_file(asfd, sdirs, cconf, cb, p1b, ucfp, dpthl))) { if(ars<0) goto error; // Do not free it - need to send stuff. break; } } } } } goto end; error: ret=-1; end: if(close_fp(&p2fp)) { logp("error closing %s in backup_phase2_server\n", sdirs->phase2data); ret=-1; } if(close_fp(&ucfp)) { logp("error closing %s in backup_phase2_server\n", sdirs->unchangeddata); ret=-1; } free(deltmppath); sbuf_free(cb); sbuf_free(p1b); sbuf_free(rb); gzclose_fp(&p1zp); if(!ret) unlink(sdirs->phase1data); logp("End phase2 (receive file data)\n"); return ret; }