| 1937 | } |
| 1938 | |
| 1939 | static int kwsysProcessSetupOutputPipeFile(int* p, char const* name) |
| 1940 | { |
| 1941 | int fout; |
| 1942 | if (!name) { |
| 1943 | return 1; |
| 1944 | } |
| 1945 | |
| 1946 | /* Close the existing descriptor. */ |
| 1947 | kwsysProcessCleanupDescriptor(p); |
| 1948 | |
| 1949 | /* Open a file for the pipe to write. */ |
| 1950 | if ((fout = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) { |
| 1951 | return 0; |
| 1952 | } |
| 1953 | |
| 1954 | /* Set close-on-exec flag on the pipe's end. */ |
| 1955 | if (fcntl(fout, F_SETFD, FD_CLOEXEC) < 0) { |
| 1956 | close(fout); |
| 1957 | return 0; |
| 1958 | } |
| 1959 | |
| 1960 | /* Assign the replacement descriptor. */ |
| 1961 | *p = fout; |
| 1962 | return 1; |
| 1963 | } |
| 1964 | |
| 1965 | static int kwsysProcessSetupOutputPipeNative(int* p, int des[2]) |
| 1966 | { |
no test coverage detected
searching dependent graphs…