Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: srtp/crypto/kernel/err.c

Issue 889083003: Update libsrtp to upstream 1.5.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libsrtp@master
Patch Set: Updated to libsrtp 1.5.1 Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « srtp/crypto/kernel/crypto_kernel.c ('k') | srtp/crypto/kernel/key.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * err.c 2 * err.c
3 * 3 *
4 * error status reporting functions 4 * error status reporting functions
5 * 5 *
6 * David A. McGrew 6 * David A. McGrew
7 * Cisco Systems, Inc. 7 * Cisco Systems, Inc.
8 */ 8 */
9 /* 9 /*
10 * 10 *
(...skipping 24 matching lines...) Expand all
35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
41 * OF THE POSSIBILITY OF SUCH DAMAGE. 41 * OF THE POSSIBILITY OF SUCH DAMAGE.
42 * 42 *
43 */ 43 */
44 44
45 #ifdef HAVE_CONFIG_H
46 #include <config.h>
47 #endif
48
45 #include "err.h" 49 #include "err.h"
46 50
47 #ifdef ERR_REPORTING_SYSLOG 51 #ifdef ERR_REPORTING_SYSLOG
48 # ifdef HAVE_SYSLOG_H 52 # ifdef HAVE_SYSLOG_H
49 # include <syslog.h> 53 # include <syslog.h>
50 # endif 54 # endif
51 #endif 55 #endif
52 56
53 57
54 /* err_level reflects the level of errors that are reported */ 58 /* err_level reflects the level of errors that are reported */
55 59
56 err_reporting_level_t err_level = err_level_none; 60 err_reporting_level_t err_level = err_level_none;
57 61
58 #ifdef SRTP_KERNEL_LINUX 62 #ifdef SRTP_KERNEL_LINUX
59 err_status_t 63 err_status_t
60 err_reporting_init(char *ident) { 64 err_reporting_init(const char *ident) {
61 65
62 return err_status_ok; 66 return err_status_ok;
63 } 67 }
64 68
65 #else /* SRTP_KERNEL_LINUX */ 69 #else /* SRTP_KERNEL_LINUX */
66 70
67 /* err_file is the FILE to which errors are reported */ 71 /* err_file is the FILE to which errors are reported */
68 72
69 static FILE *err_file = NULL; 73 static FILE *err_file = NULL;
70 74
71 err_status_t 75 err_status_t
72 err_reporting_init(char *ident) { 76 err_reporting_init(const char *ident) {
73 #ifdef ERR_REPORTING_SYSLOG 77 #ifdef ERR_REPORTING_SYSLOG
74 openlog(ident, LOG_PID, LOG_AUTHPRIV); 78 openlog(ident, LOG_PID, LOG_AUTHPRIV);
75 #endif 79 #endif
76 80
77 /* 81 /*
78 * Believe it or not, openlog doesn't return an error on failure. 82 * Believe it or not, openlog doesn't return an error on failure.
79 * But then, neither does the syslog() call... 83 * But then, neither does the syslog() call...
80 */ 84 */
81 85
82 #ifdef ERR_REPORTING_STDOUT 86 #ifdef ERR_REPORTING_STDOUT
83 err_file = stdout; 87 err_file = stdout;
84 #elif defined(USE_ERR_REPORTING_FILE) 88 #elif defined(USE_ERR_REPORTING_FILE)
85 /* open file for error reporting */ 89 /* open file for error reporting */
86 err_file = fopen(ERR_REPORTING_FILE, "w"); 90 err_file = fopen(ERR_REPORTING_FILE, "w");
87 if (err_file == NULL) 91 if (err_file == NULL)
88 return err_status_init_fail; 92 return err_status_init_fail;
89 #endif 93 #endif
90 94
91 return err_status_ok; 95 return err_status_ok;
92 } 96 }
93 97
94 void 98 void
95 err_report(int priority, char *format, ...) { 99 err_report(int priority, const char *format, ...) {
96 va_list args; 100 va_list args;
97 101
98 if (priority <= err_level) { 102 if (priority <= err_level) {
99 103
100 va_start(args, format); 104 va_start(args, format);
101 if (err_file != NULL) { 105 if (err_file != NULL) {
102 vfprintf(err_file, format, args); 106 vfprintf(err_file, format, args);
103 /* fprintf(err_file, "\n"); */ 107 /* fprintf(err_file, "\n"); */
104 } 108 }
105 #ifdef ERR_REPORTING_SYSLOG 109 #ifdef ERR_REPORTING_SYSLOG
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 #endif 143 #endif
140 va_end(args); 144 va_end(args);
141 } 145 }
142 } 146 }
143 #endif /* SRTP_KERNEL_LINUX */ 147 #endif /* SRTP_KERNEL_LINUX */
144 148
145 void 149 void
146 err_reporting_set_level(err_reporting_level_t lvl) { 150 err_reporting_set_level(err_reporting_level_t lvl) {
147 err_level = lvl; 151 err_level = lvl;
148 } 152 }
OLDNEW
« no previous file with comments | « srtp/crypto/kernel/crypto_kernel.c ('k') | srtp/crypto/kernel/key.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698