コード例 #1
0
ファイル: Service.cpp プロジェクト: kleopatra999/finx
Service::Service(const char *filepath, const char *type)
{
  strncpy(type_, type, DEFAULT_STRING_LENGTH);
  setupPaths(filepath);
  pid_ = 0;
  state_ = STOPPED;
  port_ = 0;
  argumentsNumber_ = 0;
  timeout_ = 15;
}
コード例 #2
0
 void loadObjectList() {
     auto self = shared_from_this();
     setupPaths();
     vfs_search_context_t *context = vfs_findFirst(_objectLocationPath.c_str(), "obj", VFS_SEARCH_DIR | VFS_SEARCH_BARE);
     while (context) {
         std::string objName = vfs_search_context_get_current(context);
         _objects.emplace_back(new ObjectGUIContainer(objName, self));
         vfs_findNext(&context);
     }
     vfs_findClose(&context);
 }
コード例 #3
0
static int testHdfsOperationsImpl(struct tlhThreadInfo *ti)
{
    hdfsFS fs = NULL;
    struct tlhPaths paths;

    fprintf(stderr, "testHdfsOperations(threadIdx=%d): starting\n",
        ti->threadIdx);
    EXPECT_ZERO(hdfsSingleNameNodeConnect(tlhCluster, &fs, NULL));
    EXPECT_ZERO(setupPaths(ti, &paths));
    // test some operations
    EXPECT_ZERO(doTestHdfsOperations(ti, fs, &paths));
    EXPECT_ZERO(hdfsDisconnect(fs));
    // reconnect as user "foo" and verify that we get permission errors
    EXPECT_ZERO(hdfsSingleNameNodeConnect(tlhCluster, &fs, "foo"));
    EXPECT_NEGATIVE_ONE_WITH_ERRNO(hdfsChown(fs, paths.file1, "ha3", NULL), EACCES);
    EXPECT_ZERO(hdfsDisconnect(fs));
    // reconnect to do the final delete.
    EXPECT_ZERO(hdfsSingleNameNodeConnect(tlhCluster, &fs, NULL));
    EXPECT_ZERO(hdfsDelete(fs, paths.prefix, 1));
    EXPECT_ZERO(hdfsDisconnect(fs));
    return 0;
}
コード例 #4
0
//-----------------------------------------------------------------------------
// LLUICtrlFactory()
//-----------------------------------------------------------------------------
LLUICtrlFactory::LLUICtrlFactory()
	: mDummyPanel(NULL)
{
	setupPaths();
}
コード例 #5
0
ファイル: Service.cpp プロジェクト: kleopatra999/finx
int Service::renameDirectory(const char* prefix)
{
  char *slash = NULL;

  char path[DEFAULT_STRING_LENGTH];

  strncpy(path, rootPath_, DEFAULT_STRING_LENGTH);

  slash = strrchr(path, '/');

  if (slash == NULL)
  {
    return -1;
  }

  char *name = new char[strlen(slash) + strlen(prefix) + 1];

  if (name == NULL)
  {
    return -1;
  }

  strcpy(name, prefix);

  //
  // this is safe in the worst case slash + 1 will be '\0'
  //
  strcat(name, slash + 1);

  #ifdef DEBUG
  logUser("Info: renameDirectory: name='%s'",name);
  #endif

  if (strlen(path) + strlen(prefix) > DEFAULT_STRING_LENGTH)
  {
    return -1;
  }

  strcpy(slash + 1, name);

  //
  // FIXME: Sometimes we try to rename the session directories
  // before a service closes its log file. Should we retry
  // until the rename succeded?
  //

  if (rename((const char*)rootPath_, (const char*)path))
  {
    logUser("Error: Cannot rename '%s' to '%s'. Error is '%s'", rootPath_, path, strerror(errno));
    return -1;
  }
  else
  {
    return -1;
  }

  setupPaths(path);

  delete [] name;

  return 0;
}