Description
In traffic_cop 'main' function, before it forks traffic_manager, it will first close stdin, stdout, and stderr and then redirect them to /dev/null.
But when it closes the fd opened by /dev/null, it doesn't check whether the fd is 0, 1 or 2. So, in current code logic, the fd may be 1, and after close it, later opened file will uses the fd 1, and printf will corrupt that file.
1826 if (!stdout_flag) {
1827 close(STDIN_FILENO);
1828 close(STDOUT_FILENO);
1829 close(STDERR_FILENO);
1830 if ((fd = open("/dev/null", O_WRONLY, 0)) >= 0)
else
{ 1836 ink_fputln(stderr, "Unable to open /dev/null"); 1837 return 0; 1838 }1839 }
Attachments
Issue Links
- duplicates
-
TS-3287 Coverity fixes for v5.3.0 by zwoop
- Closed