示例#1
0
int	check_relative_cmd(char *buffer, struct s_static_socket *br)
{
  char	abso[2048];

  get_abso(abso, buffer);
  set_append(buffer, br);
  if (argument(buffer) != -1)
    {
      if (strncmp(buffer, "RETR", 4) == 0)
	retrieve_file(abso, br);
      else
	if (strncmp(buffer, "STOR", 4) == 0
	    || strncmp(buffer, "APPE", 4) == 0)
	  store_file(abso, br, 0);
	else
	  if (strncmp(buffer, "STOU", 4) == 0)
	    store_file(abso, br, 1);
	  else
	    if (check_relative_cmd_suite(buffer, abso, br) == -1)
	      return (-1);
      br->append = 0;
      my_putstr(abso);
      my_putstr("\n");
    }
  else
    return (-1);
  return (0);
}
示例#2
0
int miscfiles_postmove(int argc, char *argv[]) {
    struct file_t *f;

    postmove_call_count++;
    for (f=file_head.next; f != &file_head; f = f->next) {
	if (f->call == postmove_call_count)
	    if (store_file(f))
		return -1;
    }
    return 0;
}
示例#3
0
FILE *big_fopen(char *p, char *file, char *mode)
{
	FILE *fp = fopen(file, mode);
	if (debug > 1) {
		mrlog("Opening '%s' in mode %s (%p) on behalf of %s",
			file, mode, fp, p);
	}
	if (fp == NULL) {
		mrlog("Can't open");
	} else {
		store_file(fp, p);
	}
	return fp;
}
static int store_st(struct DEDUPE_STORE_CONTEXT *context, struct stat st, const char* s) {
    if (S_ISREG(st.st_mode)) {
        print_stat(context, 'f', st, s);
        return store_file(context, st, s);
    }
    else if (S_ISDIR(st.st_mode)) {
        print_stat(context, 'd', st, s);
        fprintf(context->output_manifest, "\n");
        return store_dir(context, st, s);
    }
    else if (S_ISLNK(st.st_mode)) {
        print_stat(context, 'l', st, s);
        return store_link(context, st, s);
    }
    else {
        fprintf(stderr, "Skipping special: %s\n", s);
        return 0;
    }
}