From a8f63eec9bca4a3a58699294b4c6216d5240c1d0 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 11 Nov 2021 12:49:01 +0900 Subject: [PATCH] Fix id file creation The child process writes zero to the id file. When calling the aul_initialize(), the process will write one to the id file. This is to check the socket status of the running application. Requires: - https://review.tizen.org/gerrit/#/c/platform/core/appfw/launchpad/+/266359/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/aul-1/+/266360/ - https://review.tizen.org/gerrit/#/c/platform/core/appfw/amd/+/266361/ Change-Id: I0abe08650b60d4e97f039ffaa16a20c299054110 Signed-off-by: Hwankyu Jhun --- src/lib/common/src/launchpad_common.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/common/src/launchpad_common.c b/src/lib/common/src/launchpad_common.c index 17ab641..7bfd547 100644 --- a/src/lib/common/src/launchpad_common.c +++ b/src/lib/common/src/launchpad_common.c @@ -1415,17 +1415,18 @@ int _verify_proc_caps(void) int _prepare_id_file(void) { char path[PATH_MAX]; - int fd; + FILE* fp; 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); + fp = fopen(path, "w"); + if (!fp) { + _E("fopen() is failed. path(%s), errno(%d)", path, errno); return -1; } - close(fd); + fprintf(fp, "0"); + fclose(fp); return 0; } -- 2.7.4