* recipient: * tcp:127.0.0.1:8088 * udp:127.0.0.1:8088 * unix:/var/log/unix.sock * file:/var/log/unix.log * /var/log/unix.log */
| 566 | * /var/log/unix.log |
| 567 | */ |
| 568 | static int open_log(const char *recipient, const char *logpre) |
| 569 | { |
| 570 | const char *myname = "open_log"; |
| 571 | const char *ptr; |
| 572 | |
| 573 | if (strncasecmp(recipient, "tcp:", 4) == 0) { |
| 574 | ptr = recipient + 4; |
| 575 | if (acl_ipv4_addr_valid(ptr) == 0) { |
| 576 | printf("%s(%d): recipient(%s) invalid", |
| 577 | myname, __LINE__, recipient); |
| 578 | return -1; |
| 579 | } |
| 580 | return open_tcp_log(ptr, logpre); |
| 581 | } else if (strncasecmp(recipient, "udp:", 4) == 0) { |
| 582 | ptr = recipient + 4; |
| 583 | if (acl_ipv4_addr_valid(ptr) == 0) { |
| 584 | printf("%s(%d): recipient(%s) invalid", |
| 585 | myname, __LINE__, recipient); |
| 586 | return -1; |
| 587 | } |
| 588 | return open_udp_log(ptr, logpre); |
| 589 | } else if (strncasecmp(recipient, "unix:", 5) == 0) { |
| 590 | ptr = recipient + 5; |
| 591 | if (*ptr == 0) { |
| 592 | printf("%s(%d): recipient(%s) invalid", |
| 593 | myname, __LINE__, recipient); |
| 594 | return -1; |
| 595 | } |
| 596 | return open_unix_log(ptr, logpre); |
| 597 | } else if (strncasecmp(recipient, "file:", 5) == 0) { |
| 598 | ptr = recipient + 5; |
| 599 | if (*ptr == 0) { |
| 600 | printf("%s(%d): recipient(%s) invalid", |
| 601 | myname, __LINE__, recipient); |
| 602 | return -1; |
| 603 | } |
| 604 | return open_file_log(recipient, logpre); |
| 605 | } else |
| 606 | return open_file_log(recipient, logpre); |
| 607 | } |
| 608 | |
| 609 | #if defined(ACL_UNIX) && !defined(ACL_ANDROID) |
| 610 | static void fork_prepare(void) |
no test coverage detected
searching dependent graphs…