mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-09 23:00:07 +00:00
misc: syslog: Use CLOC_EXEC with _PATH_CONSOLE (BZ #17145)
The syslog open the '/dev/console' for LOG_CONS without O_CLOEXEC, which might leak in multithread programs that call fork. Checked on x86_64-linux-gnu.
This commit is contained in:
parent
ded3cef361
commit
7f3ab33f20
@ -284,7 +284,8 @@ __vsyslog_internal(int pri, const char *fmt, va_list ap,
|
|||||||
* syslogd failure.
|
* syslogd failure.
|
||||||
*/
|
*/
|
||||||
if (LogStat & LOG_CONS &&
|
if (LogStat & LOG_CONS &&
|
||||||
(fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
|
(fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY|O_CLOEXEC,
|
||||||
|
0)) >= 0)
|
||||||
{
|
{
|
||||||
__dprintf (fd, "%s\r\n", buf + msgoff);
|
__dprintf (fd, "%s\r\n", buf + msgoff);
|
||||||
(void)__close(fd);
|
(void)__close(fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user