Disable -Werror=format-security on GCC as the input is already validated by the caller
[mono.git] / support / syslog.c
1 /*
2  * <syslog.h> wrapper functions.
3  *
4  * Authors:
5  *   Jonathan Pryor (jonpryor@vt.edu)
6  *
7  * Copyright (C) 2005 Jonathan Pryor
8  */
9
10 #include <stdarg.h>
11 #include <syslog.h>
12 #include <errno.h>
13
14 #include "map.h"
15 #include "mph.h"
16 #include <glib.h>
17
18 G_BEGIN_DECLS
19
20 int
21 Mono_Posix_Syscall_openlog (void* ident, int option, int facility)
22 {
23         openlog ((const char*) ident, option, facility);
24         return 0;
25 }
26
27 int
28 Mono_Posix_Syscall_closelog (void)
29 {
30         closelog ();
31         return 0;
32 }
33
34 int
35 Mono_Posix_Syscall_syslog (int priority, const char* message)
36 {
37 #ifdef __GNUC__
38         #pragma GCC diagnostic push
39         #pragma GCC diagnostic ignored "-Wformat-security"
40 #endif
41
42         syslog (priority, message);
43
44 #ifdef __GNUC__
45         #pragma GCC diagnostic pop
46 #endif
47         return 0;
48 }
49
50 /* vararg version of syslog(3). */
51 gint32
52 Mono_Posix_Syscall_syslog2 (int priority, const char *format, ...)
53 {
54         va_list ap;
55
56         va_start (ap, format);
57         vsyslog (priority, format, ap);
58         va_end (ap);
59
60         return 0;
61 }
62
63
64 G_END_DECLS
65
66 /*
67  * vim: noexpandtab
68  */