| 4019 | Exit with a diagnostic on failure. */ |
| 4020 | |
| 4021 | static void |
| 4022 | check_output (char const *outfile) |
| 4023 | { |
| 4024 | if (outfile) |
| 4025 | { |
| 4026 | int oflags = O_WRONLY | O_BINARY | O_CLOEXEC | O_CREAT; |
| 4027 | int outfd = open (outfile, oflags, MODE_RW_UGO); |
| 4028 | if (outfd < 0) |
| 4029 | sort_die (_("open failed"), outfile); |
| 4030 | move_fd (outfd, STDOUT_FILENO); |
| 4031 | } |
| 4032 | } |
| 4033 | |
| 4034 | /* Merge the input FILES. NTEMPS is the number of files at the |
| 4035 | start of FILES that are temporary; it is zero at the top level. |