Fix standard I/O redirection 71/106271/2 accepted/tizen/3.0/common/20161222.075011 accepted/tizen/3.0/ivi/20161221.103942 accepted/tizen/3.0/mobile/20161221.103647 accepted/tizen/3.0/tv/20161221.103834 accepted/tizen/3.0/wearable/20161221.103923 submit/tizen_3.0/20161221.012134
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 21 Dec 2016 07:36:01 +0000 (16:36 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 21 Dec 2016 07:52:35 +0000 (16:52 +0900)
- The child process doesn't redirect std fds when
the launch request is for debugging.

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

index 0ccd9f9..f1c8011 100755 (executable)
@@ -34,7 +34,6 @@
 #include <linux/limits.h>
 #include <ttrace.h>
 #include <vconf.h>
-#include <libgen.h>
 
 #include "perf.h"
 #include "launchpad_common.h"
@@ -509,7 +508,7 @@ static int __normal_fork_exec(int argc, char **argv, const char *app_path)
        }
 
        _close_all_fds();
-       _setup_stdio(basename(argv[LOADER_ARG_PATH]));
+
        if (execv(argv[LOADER_ARG_PATH], argv) < 0) { /* Flawfinder: ignore */
                if (errno == EACCES) {
                        _E("such a file is no executable - %s",
@@ -716,6 +715,9 @@ static int __prepare_exec(const char *appid, const char *app_path,
                        return PAD_ERR_REJECTED;
        }
 
+       if (bundle_get_type(kb, AUL_K_SDK) == BUNDLE_TYPE_NONE)
+               _setup_stdio(basename(app_path));
+
        /* SET DUMPABLE - for coredump*/
        prctl(PR_SET_DUMPABLE, 1);