| 1898 | |
| 1899 | |
| 1900 | AP_DECLARE(piped_log *) ap_open_piped_log_ex(apr_pool_t *p, |
| 1901 | const char *program, |
| 1902 | apr_cmdtype_e cmdtype) |
| 1903 | { |
| 1904 | piped_log *pl; |
| 1905 | |
| 1906 | pl = apr_palloc(p, sizeof (*pl)); |
| 1907 | pl->p = p; |
| 1908 | pl->program = apr_pstrdup(p, program); |
| 1909 | pl->pid = NULL; |
| 1910 | pl->cmdtype = cmdtype; |
| 1911 | if (apr_file_pipe_create_ex(&pl->read_fd, |
| 1912 | &pl->write_fd, |
| 1913 | APR_FULL_BLOCK, p) != APR_SUCCESS) { |
| 1914 | return NULL; |
| 1915 | } |
| 1916 | apr_pool_cleanup_register(p, pl, piped_log_cleanup, |
| 1917 | piped_log_cleanup_for_exec); |
| 1918 | if (piped_log_spawn(pl) != APR_SUCCESS) { |
| 1919 | apr_pool_cleanup_kill(p, pl, piped_log_cleanup); |
| 1920 | apr_file_close(pl->read_fd); |
| 1921 | apr_file_close(pl->write_fd); |
| 1922 | return NULL; |
| 1923 | } |
| 1924 | return pl; |
| 1925 | } |
| 1926 | |
| 1927 | #else /* !AP_HAVE_RELIABLE_PIPED_LOGS */ |
| 1928 |
no test coverage detected