remove redundant file open
[framework/osp/loader.git] / osp-ui-app-loader / uiapp_loader.c
index cc4bf3f..d3bb2e6 100644 (file)
@@ -242,41 +242,6 @@ get_package_name_from_appid_executable_name(const char appid[], const char execu
        return 0;
 }
 
-static int
-get_dir_fd_from_path(const char* path)
-{
-       int i = 0;
-       int count = 0;
-       const int len = strlen(path);
-       char dname[PATH_MAX];
-       memset(dname, 0, PATH_MAX);
-
-       const char* p = path + len;
-       for (i = 0; i < len; i++, p--)
-       {
-               if (*p == '/')
-               {
-                       count++;
-
-                       if (count == 2)
-                       {
-                               goto OUT;
-                       }
-               }
-       }
-
-       LOGI("Wrong path format : %s.", path);
-
-       return -1;
-
-OUT:
-       strncpy(dname, path, p - path);
-
-       const int fd = open(dname, O_RDONLY | O_CLOEXEC | O_DIRECTORY);
-       
-       LOGI("Directory path : %s, fd : %d.", dname, fd);
-       return fd;
-}
 
 int
 main(int argc, char* argv[])
@@ -339,15 +304,6 @@ main(int argc, char* argv[])
                return -1;
        }
 
-       int fd = get_dir_fd_from_path(argv[0]);
-       if (fd == -1)
-       {
-               LOGE("Failed to open path.");
-               fprintf(stderr, "Failed to open %s.\n", argv[0]);
-               dlclose(so_handle);
-               return -1;
-       }
-
        handle = dlopen(buffer, RTLD_LAZY | RTLD_GLOBAL);
        if (!handle)
        {
@@ -367,7 +323,7 @@ main(int argc, char* argv[])
        }
 
        // actual initialization
-       (*pAppInfoInit)(appid, executable_name, argc, argv, fd);
+       (*pAppInfoInit)(appid, executable_name, argc, argv, -1);
        (*pRealMain)(argc, argv);
 
        LOGI("Osp application terminates.");