Prepare ID file 03/197903/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 17 Jan 2019 04:41:27 +0000 (13:41 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 17 Jan 2019 04:41:27 +0000 (13:41 +0900)
Before executing an application, the child process creates the ID file.
If's for Application Manager.

Change-Id: I4e561b80071c12fb786ca89cab8a968d25e159ff
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
inc/launchpad_common.h
src/launchpad.c
src/launchpad_common.c
src/launchpad_lib.c

index 4662d3d..4776a44 100644 (file)
@@ -129,6 +129,7 @@ int _wait_tep_mount(bundle *b);
 int _prepare_app_socket(void);
 int _enable_external_pkg(bundle *b, const char *pkgid, uid_t pkg_uid);
 int _verify_proc_caps(void);
+int _prepare_id_file(void);
 
 #endif /* __LAUNCHPAD_COMMON_H__ */
 
index 3b2592a..f6d5301 100755 (executable)
@@ -1005,6 +1005,10 @@ static int __prepare_exec(const char *appid, const char *app_path,
                ret = _prepare_app_socket();
                if (ret < 0)
                        return PAD_ERR_FAILED;
+
+               ret = _prepare_id_file();
+               if (ret < 0)
+                       return PAD_ERR_FAILED;
        }
 
        return 0;
index da3ba04..21cb409 100644 (file)
@@ -1353,3 +1353,20 @@ int _verify_proc_caps(void)
 
        return 0;
 }
+
+int _prepare_id_file(void)
+{
+       char path[PATH_MAX];
+       int fd;
+
+       snprintf(path, sizeof(path), "/run/aul/apps/%u/%d/%s",
+                       getuid(), getpid(), getenv("AUL_APPID"));
+       fd = open(path, O_CREAT | O_WRONLY | O_TRUNC, 0600);
+       if (fd < 0) {
+               _E("Failed to create %s. errno(%d)", path, errno);
+               return -1;
+       }
+       close(fd);
+
+       return 0;
+}
index dd7620a..4041141 100644 (file)
@@ -145,6 +145,10 @@ static int __prepare_exec(const char *appid, const char *app_path,
        if (ret < 0)
                return -1;
 
+       ret = _prepare_id_file();
+       if (ret < 0)
+               return -1;
+
        return 0;
 }