Lines Matching refs:rootPath
320 if (sandbox->rootPath == NULL) {
327 sandbox->rootPath = strdup(rootdir);
328 BEGET_ERROR_CHECK(sandbox->rootPath != NULL, return -1,
467 if (sandbox->rootPath == NULL) {
479 const char *rootPath = (const char *)data;
482 BEGET_ERROR_CHECK(snprintf_s(target, PATH_MAX, PATH_MAX - 1, "%s%s", rootPath, info->target) > 0,
494 static int MountSandboxInfo(struct ListNode *head, const char *rootPath, SandboxTag tag)
496 if ((head == NULL) || (rootPath == NULL)) {
499 int ret = OH_ListTraversal(head, (void *)rootPath, MountSandboxNode, 1);
508 const char *rootPath = (const char *)data;
511 BEGET_ERROR_CHECK(!(snprintf_s(linkName, PATH_MAX, PATH_MAX - 1, "%s%s", rootPath, info->linkName) < 0),
525 static int LinkSandboxInfo(struct ListNode *head, const char *rootPath)
527 if ((head == NULL) || (rootPath == NULL)) {
530 int ret = OH_ListTraversal(head, (void *)rootPath, LinkSandboxNode, 1);
543 BEGET_CHECK(sandbox->rootPath != NULL, return -1);
545 BEGET_ERROR_CHECK(CheckAndMakeDir(sandbox->rootPath, mode) == 0, return -1, "Failed root %s.", sandbox->rootPath);
548 rc = BindMount(sandbox->rootPath, sandbox->rootPath, MS_BIND | MS_REC, SANDBOX_TAG_MOUNT_PATH);
552 rc = MountSandboxInfo(&sandbox->pathMountsHead, sandbox->rootPath, SANDBOX_TAG_MOUNT_PATH);
555 rc = MountSandboxInfo(&sandbox->fileMountsHead, sandbox->rootPath, SANDBOX_TAG_MOUNT_FILE);
559 rc = LinkSandboxInfo(&sandbox->linksHead, sandbox->rootPath);
562 BEGET_ERROR_CHECK(chdir(sandbox->rootPath) == 0, return -1, "Change to %s, err = %d", sandbox->rootPath, errno);
563 BEGET_ERROR_CHECK(syscall(SYS_pivot_root, sandbox->rootPath, sandbox->rootPath) == 0, return -1,
604 if (sandbox->rootPath != NULL) {
605 free(sandbox->rootPath);
606 sandbox->rootPath = NULL;
694 printf("Sandbox root path is %s. \n", map->sandbox->rootPath);