weston: Set CLOEXEC on stdin

We don't want to leak this into apps launched from the panel.

stdout and stderr are left for now because some things launched
by weston - such as weston-keyboard - share weston's log by
printing to those fds.

I'm singling out stdin because it's never needed by a child process
and because it's value is 0, which makes it easy to accidentally
do bad things to (commit 5c611d933f)

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Derek Foreman 2017-03-24 09:41:12 -05:00 committed by Quentin Glidic
parent 5ef6bd7eee
commit f0d39b2243
No known key found for this signature in database
GPG key ID: AC203F96E2C34BB7

View file

@ -1800,6 +1800,11 @@ int main(int argc, char *argv[])
{ WESTON_OPTION_STRING, "config", 'c', &config_file },
};
if (os_fd_set_cloexec(fileno(stdin))) {
printf("Unable to set stdin as close on exec().\n");
return EXIT_FAILURE;
}
cmdline = copy_command_line(argc, argv);
parse_options(core_options, ARRAY_LENGTH(core_options), &argc, argv);