| 805 | } |
| 806 | |
| 807 | const char * |
| 808 | pcmk_strerror(int rc) |
| 809 | { |
| 810 | int error = rc; |
| 811 | if(rc < 0) { |
| 812 | error = 0 - rc; |
| 813 | } |
| 814 | |
| 815 | if(error == 0) { |
| 816 | return "OK"; |
| 817 | } else if(error < PCMK_ERROR_OFFSET) { |
| 818 | return strerror(error); |
| 819 | } |
| 820 | |
| 821 | switch(error) { |
| 822 | case pcmk_err_generic: |
| 823 | return "Generic Pacemaker error"; |
| 824 | case pcmk_err_no_quorum: |
| 825 | return "Operation requires quorum"; |
| 826 | case pcmk_err_dtd_validation: |
| 827 | return "Update does not conform to the configured schema"; |
| 828 | case pcmk_err_transform_failed: |
| 829 | return "Schema transform failed"; |
| 830 | case pcmk_err_old_data: |
| 831 | return "Update was older than existing configuration"; |
| 832 | case pcmk_err_diff_failed: |
| 833 | return "Application of an update diff failed"; |
| 834 | case pcmk_err_diff_resync: |
| 835 | return "Application of an update diff failed, requesting a full refresh"; |
| 836 | |
| 837 | /* The following cases will only be hit on systems for which they are non-standard */ |
| 838 | /* coverity[dead_error_condition] False positive on non-Linux */ |
| 839 | case ENOTUNIQ: |
| 840 | return "Name not unique on network"; |
| 841 | /* coverity[dead_error_condition] False positive on non-Linux */ |
| 842 | case ECOMM: |
| 843 | return "Communication error on send"; |
| 844 | /* coverity[dead_error_condition] False positive on non-Linux */ |
| 845 | case ELIBACC: |
| 846 | return "Can not access a needed shared library"; |
| 847 | /* coverity[dead_error_condition] False positive on non-Linux */ |
| 848 | case EREMOTEIO: |
| 849 | return "Remote I/O error"; |
| 850 | /* coverity[dead_error_condition] False positive on non-Linux */ |
| 851 | case EUNATCH: |
| 852 | return "Protocol driver not attached"; |
| 853 | /* coverity[dead_error_condition] False positive on non-Linux */ |
| 854 | case ENOKEY: |
| 855 | return "Required key not available"; |
| 856 | } |
| 857 | |
| 858 | crm_err("Unknown error code: %d", rc); |
| 859 | return "Unknown error"; |
| 860 | } |
| 861 | |
| 862 | |
| 863 | void crm_log_output_fn(const char *file, const char *function, int line, int level, const char *prefix, const char *output) |