Beispiel #1
0
int ldcs_create_server_pipe(char* location, int number) {
  int fd;

  fd=get_new_fd_pipe();
  if(fd<0) return(-1);

  int len = strlen(location) + 32;
  char *staging_dir = (char *) malloc(len);
  snprintf(staging_dir, len, "%s/spindle_comm", location);

  if (-1 == spindle_mkdir(staging_dir)) {
     printf("mkdir: ERROR during mkdir %s\n", staging_dir);
     _error("mkdir failed");
  }

  /* FiFos will be created by client */
  /* -> setup notify to get new connections */
  fdlist_pipe[fd].type=LDCS_PIPE_FD_TYPE_SERVER;
  fdlist_pipe[fd].notify_fd=ldcs_notify_init(staging_dir);
  fdlist_pipe[fd].conn_list=NULL;
  fdlist_pipe[fd].conn_list_size=0;
  fdlist_pipe[fd].conn_list_used=0;
  fdlist_pipe[fd].path=staging_dir;
  fdlist_pipe[fd].in_fn=NULL;
  fdlist_pipe[fd].out_fn=NULL;
  
  char path[MAX_PATH_LEN];
  snprintf(path, MAX_PATH_LEN, "%s/ready", staging_dir);
  int readyfd = creat(path, 0600);
  close(readyfd);

  return(fd);
}
int ldcs_audit_server_filemngt_init (char* location) {
   int rc=0;

   _ldcs_audit_server_tmpdir = location;
   if (-1 == spindle_mkdir(_ldcs_audit_server_tmpdir)) {
      err_printf("mkdir: ERROR during mkdir %s\n", _ldcs_audit_server_tmpdir);
      _error("mkdir failed");
   }
   normalized_tmpdir = filemngt_normalize_dir(location);
   
   return(rc);
}