This is needed for child processes to be able to write to fd 2 without failing.
For example, rsync will not be able to write an error message because of "Bad
file descriptor" which in turn leads to rsync exiting with meaningless exit
code 13 ("Errors with program diagnostics"), masking the actual error and exit
code.
The fact that rsync uses exit code 13 in that case makes this bug particularly
painful since 13 is interpreted by dss as a temporary rsync error that can be
"fixed" by simply restarting rsync. This can lead to an infinite loop,
obviously.
goto err_out;
if (!fds[0] || !fds[1] || !fds[2]) {
ret = -E_NULL_OPEN;
- null = open("/dev/null", O_RDONLY);
+ null = open("/dev/null", O_RDWR);
if (null < 0)
goto err_out;
}